have error function only print errno if it's nonzero
authorChris G. Demetriou <cgd@ucbvax.Berkeley.EDU>
Sat, 5 Jun 1993 08:34:52 +0000 (00:34 -0800)
committerChris G. Demetriou <cgd@ucbvax.Berkeley.EDU>
Sat, 5 Jun 1993 08:34:52 +0000 (00:34 -0800)
SCCS-vsn: libexec/lfs_cleanerd/misc.c 5.2

usr/src/libexec/lfs_cleanerd/misc.c

index 3af35d2..e2ad8bc 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)misc.c     5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)misc.c     5.2 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -43,7 +43,9 @@ err(fmt, va_alist)
        (void)fprintf(stderr, "%s: ", special);
        (void)vfprintf(stderr, fmt, ap);
        va_end(ap);
        (void)fprintf(stderr, "%s: ", special);
        (void)vfprintf(stderr, fmt, ap);
        va_end(ap);
-       (void)fprintf(stderr, " %s\n", strerror(errno));
+       if (errno)
+               (void)fprintf(stderr, " %s", strerror(errno));
+       (void)fprintf(stderr, "\n");
        if (fatal)
                exit(1);
 }
        if (fatal)
                exit(1);
 }