changeset 9365:73ad59013feb

* lib/xprintf.c (xprintf, xfprintf): Test err < 0, not just "err".
author Jim Meyering <meyering@redhat.com>
date Fri, 19 Oct 2007 22:11:17 +0200
parents 559ef0e161fe
children dbb64cb4aed9
files ChangeLog lib/xprintf.c
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2007-10-19  Jim Meyering  <meyering@redhat.com>
 
+	* lib/xprintf.c (xprintf, xfprintf): Test err < 0, not just "err".
+
 	New module: xprintf
 	* modules/xprintf, lib/xprintf.c, lib/xprintf.h: New files.
 
--- a/lib/xprintf.c
+++ b/lib/xprintf.c
@@ -37,7 +37,7 @@
   va_list args;
   va_start (args, format);
   int err = vprintf (format, args);
-  if (err && (errno == EILSEQ || errno == EINVAL || errno == ENOMEM))
+  if (err < 0 && (errno == EILSEQ || errno == EINVAL || errno == ENOMEM))
     error (exit_failure, errno, gettext ("write error"));
 
   return err;
@@ -51,7 +51,7 @@
   va_list args;
   va_start (args, format);
   int err = vfprintf (stream, format, args);
-  if (err && (errno == EILSEQ || errno == EINVAL || errno == ENOMEM))
+  if (err < 0 && (errno == EILSEQ || errno == EINVAL || errno == ENOMEM))
     error (exit_failure, errno, gettext ("write error"));
 
   return err;