diff options
| author | Doug Barton <dougb@FreeBSD.org> | 2012-04-04 23:11:25 +0000 |
|---|---|---|
| committer | Doug Barton <dougb@FreeBSD.org> | 2012-04-04 23:11:25 +0000 |
| commit | 42d3eba523963ab015ac451eeea0788b11631c94 (patch) | |
| tree | d6eb268f26af23cc29cceb581dd5468a2cfef052 /lib/dns/dst_parse.c | |
| parent | 3939884dc90db099f5601bd7c27d39acf7a8c731 (diff) | |
Diffstat (limited to 'lib/dns/dst_parse.c')
| -rw-r--r-- | lib/dns/dst_parse.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/dns/dst_parse.c b/lib/dns/dst_parse.c index 4d7d784f63704..8e9efbd00c83c 100644 --- a/lib/dns/dst_parse.c +++ b/lib/dns/dst_parse.c @@ -1,5 +1,5 @@ /* - * Portions Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") + * Portions Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -31,7 +31,7 @@ /*% * Principal Author: Brian Wellington - * $Id: dst_parse.c,v 1.27 2010-12-23 04:07:58 marka Exp $ + * $Id$ */ #include <config.h> @@ -641,9 +641,7 @@ dst__privstruct_writefile(const dst_key_t *key, const dst_private_t *priv, } isc_buffer_usedregion(&b, &r); - fprintf(fp, "%s ", s); - isc_util_fwrite(r.base, 1, r.length, fp); - fprintf(fp, "\n"); + fprintf(fp, "%s %.*s\n", s, (int)r.length, r.base); } /* Add the metadata tags */ @@ -661,14 +659,15 @@ dst__privstruct_writefile(const dst_key_t *key, const dst_private_t *priv, isc_buffer_init(&b, buffer, sizeof(buffer)); result = dns_time32_totext(when, &b); - if (result != ISC_R_SUCCESS) - continue; + if (result != ISC_R_SUCCESS) { + fclose(fp); + return (DST_R_INVALIDPRIVATEKEY); + } isc_buffer_usedregion(&b, &r); - fprintf(fp, "%s ", timetags[i]); - isc_util_fwrite(r.base, 1, r.length, fp); - fprintf(fp, "\n"); + fprintf(fp, "%s %.*s\n", timetags[i], (int)r.length, + r.base); } } |
