util: Make ovs_error() understand that EOF means "end of file".
authorBen Pfaff <blp@nicira.com>
Wed, 28 Oct 2009 18:11:18 +0000 (11:11 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 4 Nov 2009 23:24:40 +0000 (15:24 -0800)
This convention is in use in a few places in the source tree, and so it
seems to be about time to start putting it into central places.

lib/util.c

index c9ef8b1..6c152e2 100644 (file)
@@ -168,8 +168,10 @@ ovs_error(int err_no, const char *format, ...)
     va_start(args, format);
     vfprintf(stderr, format, args);
     va_end(args);
-    if (err_no != 0)
-        fprintf(stderr, " (%s)", strerror(err_no));
+    if (err_no != 0) {
+        fprintf(stderr, " (%s)",
+                err_no == EOF ? "end of file" : strerror(err_no));
+    }
     putc('\n', stderr);
 
     errno = save_errno;