From d9d370720f15fe910f40603a734f67e28b261cc2 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 19 Oct 2007 22:11:17 +0200 Subject: [PATCH] * lib/xprintf.c (xprintf, xfprintf): Test err < 0, not just "err". --- ChangeLog | 2 ++ lib/xprintf.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ede13c3f1..d837fc11c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2007-10-19 Jim Meyering + * lib/xprintf.c (xprintf, xfprintf): Test err < 0, not just "err". + New module: xprintf * modules/xprintf, lib/xprintf.c, lib/xprintf.h: New files. diff --git a/lib/xprintf.c b/lib/xprintf.c index a01eff8cd..908fc4f11 100644 --- a/lib/xprintf.c +++ b/lib/xprintf.c @@ -37,7 +37,7 @@ xprintf (char const *restrict format, ...) 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 @@ xfprintf (FILE *restrict stream, char const *restrict format, ...) 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; -- 2.11.0