aboutsummaryrefslogtreecommitdiff
path: root/lib/dns/dst_parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dns/dst_parse.c')
-rw-r--r--lib/dns/dst_parse.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/dns/dst_parse.c b/lib/dns/dst_parse.c
index 4d7d784f6370..8e9efbd00c83 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);
}
}