]> diplodocus.org Git - nmh/commitdiff
Allow advertise() to assume strerror(3) won't fail.
authorRalph Corderoy <ralph@inputplus.co.uk>
Mon, 17 Apr 2017 10:50:39 +0000 (11:50 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Mon, 17 Apr 2017 10:50:39 +0000 (11:50 +0100)
The code already assumes that elsewhere when it calls strerror().

sbr/error.c

index 8057302..efd0291 100644 (file)
@@ -85,7 +85,7 @@ void
 advertise (const char *what, char *tail, const char *fmt, va_list ap)
 {
     int        eindex = errno;
-    char buffer[NMH_BUFSIZ], errbuf[NMH_BUFSIZ], *err;
+    char buffer[NMH_BUFSIZ], *err;
     struct iovec iob[10], *iov;
     size_t niov;
 
@@ -113,11 +113,6 @@ advertise (const char *what, char *tail, const char *fmt, va_list ap)
        }
         ADD_LITERAL(": ");
         err = strerror(eindex);
-        if (!err) {
-           /* this shouldn't happen, but we'll test for it just in case */
-           snprintf(errbuf, sizeof(errbuf), "Error %d", eindex);
-            err = errbuf;
-       }
         ADD_VAR(err);
     }
     if (tail && *tail) {