aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dns/masterdump.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dns/masterdump.c')
-rw-r--r--lib/dns/masterdump.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c
index 681304f589e7..b02cc11f5219 100644
--- a/lib/dns/masterdump.c
+++ b/lib/dns/masterdump.c
@@ -1483,7 +1483,8 @@ dns_master_dumptostream2(isc_mem_t *mctx, dns_db_t *db,
}
static isc_result_t
-opentmp(isc_mem_t *mctx, const char *file, char **tempp, FILE **fp) {
+opentmp(isc_mem_t *mctx, dns_masterformat_t format, const char *file,
+ char **tempp, FILE **fp) {
FILE *f = NULL;
isc_result_t result;
char *tempname = NULL;
@@ -1498,7 +1499,10 @@ opentmp(isc_mem_t *mctx, const char *file, char **tempp, FILE **fp) {
if (result != ISC_R_SUCCESS)
goto cleanup;
- result = isc_file_openunique(tempname, &f);
+ if (format == dns_masterformat_text)
+ result = isc_file_openunique(tempname, &f);
+ else
+ result = isc_file_bopenunique(tempname, &f);
if (result != ISC_R_SUCCESS) {
isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL,
DNS_LOGMODULE_MASTERDUMP, ISC_LOG_ERROR,
@@ -1542,7 +1546,7 @@ dns_master_dumpinc2(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
if (file == NULL)
return (ISC_R_NOMEMORY);
- result = opentmp(mctx, filename, &tempname, &f);
+ result = opentmp(mctx, format, filename, &tempname, &f);
if (result != ISC_R_SUCCESS)
goto cleanup;
@@ -1596,7 +1600,7 @@ dns_master_dump2(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
char *tempname;
dns_dumpctx_t *dctx = NULL;
- result = opentmp(mctx, filename, &tempname, &f);
+ result = opentmp(mctx, format, filename, &tempname, &f);
if (result != ISC_R_SUCCESS)
return (result);