summaryrefslogtreecommitdiff
path: root/usr.sbin/bind/bin/rndc
diff options
context:
space:
mode:
authorJakob Schlyter <jakob@cvs.openbsd.org>2003-02-27 19:34:00 +0000
committerJakob Schlyter <jakob@cvs.openbsd.org>2003-02-27 19:34:00 +0000
commit062ea89c0242a6d320a2430a304241443c71c2f3 (patch)
tree5c9d023758cff9055f2af16ddf535ce42765e329 /usr.sbin/bind/bin/rndc
parentbb50174cab64d156f141d84233dabeea5b37cfd3 (diff)
make rndc-confgen fail properly. tested by danh@
Diffstat (limited to 'usr.sbin/bind/bin/rndc')
-rw-r--r--usr.sbin/bind/bin/rndc/rndc-confgen.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/usr.sbin/bind/bin/rndc/rndc-confgen.c b/usr.sbin/bind/bin/rndc/rndc-confgen.c
index ba62be2b023..5ac27f03d13 100644
--- a/usr.sbin/bind/bin/rndc/rndc-confgen.c
+++ b/usr.sbin/bind/bin/rndc/rndc-confgen.c
@@ -90,31 +90,20 @@ write_key_file(const char *keyfile, const char *user,
FILE *fd;
fd = safe_create(keyfile);
- if (fd == NULL) {
- fprintf(stderr, "unable to create \"%s\"\n", keyfile);
- return;
- }
- if (user != NULL) {
- if (set_user(fd, user) == -1) {
- fprintf(stderr, "unable to set file owner\n");
- fclose(fd);
- return;
- }
- }
+ if (fd == NULL)
+ fatal("unable to create \"%s\"", keyfile);
+ if (user != NULL)
+ if (set_user(fd, user) == -1)
+ fatal("unable to set file owner");
fprintf(fd, "key \"%s\" {\n\talgorithm hmac-md5;\n"
"\tsecret \"%.*s\";\n};\n", keyname,
(int)isc_buffer_usedlength(secret),
(char *)isc_buffer_base(secret));
fflush(fd);
- if (ferror(fd)) {
- fprintf(stderr, "write to %s failed\n", keyfile);
- fclose(fd);
- return;
- }
- if (fclose(fd)) {
- fprintf(stderr, "fclose(%s) failed\n", keyfile);
- return;
- }
+ if (ferror(fd))
+ fatal("write to %s failed", keyfile);
+ if (fclose(fd))
+ fatal("fclose(%s) failed", keyfile);
}
int