errx when errno won't be set.
authortedu <tedu@openbsd.org>
Tue, 22 Apr 2014 05:44:40 +0000 (05:44 +0000)
committertedu <tedu@openbsd.org>
Tue, 22 Apr 2014 05:44:40 +0000 (05:44 +0000)
usr.bin/signify/signify.c

index 4bab03a..410d896 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: signify.c,v 1.70 2014/04/14 00:35:32 tedu Exp $ */
+/* $OpenBSD: signify.c,v 1.71 2014/04/22 05:44:40 tedu Exp $ */
 /*
  * Copyright (c) 2013 Ted Unangst <tedu@openbsd.org>
  *
@@ -137,7 +137,7 @@ parseb64file(const char *filename, char *b64, void *buf, size_t buflen,
        if (comment) {
                if (strlcpy(comment, b64 + COMMENTHDRLEN,
                    COMMENTMAXLEN) >= COMMENTMAXLEN)
-                       err(1, "comment too long");
+                       errx(1, "comment too long");
        }
        b64end = strchr(commentend + 1, '\n');
        if (!b64end)
@@ -235,7 +235,7 @@ writeb64file(const char *filename, const char *comment, const void *buf,
        fd = xopen(filename, O_CREAT|oflags|O_NOFOLLOW|O_WRONLY, mode);
        if (snprintf(header, sizeof(header), "%s%s\n",
            COMMENTHDR, comment) >= sizeof(header))
-               err(1, "comment too long");
+               errx(1, "comment too long");
        writeall(fd, header, strlen(header), filename);
        if ((rv = b64_ntop(buf, buflen, b64, sizeof(b64)-1)) == -1)
                errx(1, "b64 encode failed");
@@ -327,7 +327,7 @@ generate(const char *pubkeyfile, const char *seckeyfile, int rounds,
 
        if (snprintf(commentbuf, sizeof(commentbuf), "%s secret key",
            comment) >= sizeof(commentbuf))
-               err(1, "comment too long");
+               errx(1, "comment too long");
        writeb64file(seckeyfile, commentbuf, &enckey,
            sizeof(enckey), NULL, 0, O_EXCL, 0600);
        explicit_bzero(&enckey, sizeof(enckey));
@@ -336,7 +336,7 @@ generate(const char *pubkeyfile, const char *seckeyfile, int rounds,
        memcpy(pubkey.fingerprint, fingerprint, FPLEN);
        if (snprintf(commentbuf, sizeof(commentbuf), "%s public key",
            comment) >= sizeof(commentbuf))
-               err(1, "comment too long");
+               errx(1, "comment too long");
        writeb64file(pubkeyfile, commentbuf, &pubkey,
            sizeof(pubkey), NULL, 0, O_EXCL, 0666);
 }
@@ -383,11 +383,11 @@ sign(const char *seckeyfile, const char *msgfile, const char *sigfile,
        if ((secname = strstr(seckeyfile, ".sec")) && strlen(secname) == 4) {
                if (snprintf(sigcomment, sizeof(sigcomment), VERIFYWITH "%.*s.pub",
                    (int)strlen(seckeyfile) - 4, seckeyfile) >= sizeof(sigcomment))
-                       err(1, "comment too long");
+                       errx(1, "comment too long");
        } else {
                if (snprintf(sigcomment, sizeof(sigcomment), "signature from %s",
                    comment) >= sizeof(sigcomment))
-                       err(1, "comment too long");
+                       errx(1, "comment too long");
        }
        if (embedded)
                writeb64file(sigfile, sigcomment, &sig, sizeof(sig), msg,