diff options
Diffstat (limited to 'lib/dns/masterdump.c')
| -rw-r--r-- | lib/dns/masterdump.c | 50 | 
1 files changed, 30 insertions, 20 deletions
diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c index d6befb5d5c98d..c7e13049fecb1 100644 --- a/lib/dns/masterdump.c +++ b/lib/dns/masterdump.c @@ -15,7 +15,7 @@   * PERFORMANCE OF THIS SOFTWARE.   */ -/* $Id: masterdump.c,v 1.94.50.3.18.3 2011-06-21 20:13:22 each Exp $ */ +/* $Id: masterdump.c,v 1.94.50.10 2011-06-09 00:16:34 each Exp $ */  /*! \file */ @@ -809,9 +809,8 @@ dump_rdatasets_text(isc_mem_t *mctx, dns_name_t *name,  	for (i = 0; i < n; i++) {  		dns_rdataset_t *rds = sorted[i]; -		if (ctx->style.flags & DNS_STYLEFLAG_TRUST) { +		if (ctx->style.flags & DNS_STYLEFLAG_TRUST)  			fprintf(f, "; %s\n", dns_trust_totext(rds->trust)); -		}  		if (((rds->attributes & DNS_RDATASETATTR_NEGATIVE) != 0) &&  		    (ctx->style.flags & DNS_STYLEFLAG_NCACHE) == 0) {  			/* Omit negative cache entries */ @@ -985,6 +984,8 @@ dump_rdatasets_raw(isc_mem_t *mctx, dns_name_t *name,  						   buffer, f);  		}  		dns_rdataset_disassociate(&rdataset); +		if (result != ISC_R_SUCCESS) +			return (result);  	}  	if (result == ISC_R_NOMORE) @@ -1294,23 +1295,24 @@ dumptostreaminc(dns_dumpctx_t *dctx) {  			isc_buffer_region(&buffer, &r);  			isc_buffer_putuint32(&buffer, dns_masterformat_raw);  			isc_buffer_putuint32(&buffer, DNS_RAWFORMAT_VERSION); -			if (sizeof(now32) != sizeof(dctx->now)) { -				/* -				 * We assume isc_stdtime_t is a 32-bit integer, -				 * which should be the case on most cases. -				 * If it turns out to be uncommon, we'll need -				 * to bump the version number and revise the -				 * header format. -				 */ -				isc_log_write(dns_lctx, -					      ISC_LOGCATEGORY_GENERAL, -					      DNS_LOGMODULE_MASTERDUMP, -					      ISC_LOG_INFO, -					      "dumping master file in raw " -					      "format: stdtime is not 32bits"); -				now32 = 0; -			} else -				now32 = dctx->now; +#if !defined(STDTIME_ON_32BITS) || (STDTIME_ON_32BITS + 0) != 1 +			/* +			 * We assume isc_stdtime_t is a 32-bit integer, +			 * which should be the case on most cases. +			 * If it turns out to be uncommon, we'll need +			 * to bump the version number and revise the +			 * header format. +			 */ +			isc_log_write(dns_lctx, +				      ISC_LOGCATEGORY_GENERAL, +				      DNS_LOGMODULE_MASTERDUMP, +				      ISC_LOG_INFO, +				      "dumping master file in raw " +				      "format: stdtime is not 32bits"); +			now32 = 0; +#else +			now32 = dctx->now; +#endif  			isc_buffer_putuint32(&buffer, now32);  			INSIST(isc_buffer_usedlength(&buffer) <=  			       sizeof(rawheader)); @@ -1680,6 +1682,14 @@ dns_master_dumpnode(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,  	result = dns_master_dumpnodetostream(mctx, db, version, node, name,  					     style, f); +	if (result != ISC_R_SUCCESS) { +		isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL, +			      DNS_LOGMODULE_MASTERDUMP, ISC_LOG_ERROR, +			      "dumping master file: %s: dump: %s", filename, +			      isc_result_totext(result)); +		(void)isc_stdio_close(f); +		return (ISC_R_UNEXPECTED); +	}  	result = isc_stdio_close(f);  	if (result != ISC_R_SUCCESS) {  | 
