diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2006-02-08 00:08:38 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2006-02-08 00:08:38 +0000 |
commit | b455780a19a348df2dc265eb0910387fcb52b41b (patch) | |
tree | 8e53ed421d906e53d086f1f6d62bcd252760dbc8 /lib | |
parent | f90c6bf22eb4cf3fca3d38901c4e1baf948d2e3d (diff) | |
download | coreutils-b455780a19a348df2dc265eb0910387fcb52b41b.tar.xz |
(close_stdout): Don't assume 'bool' converts nonzero
ints to 0 or 1, as this isn't true for the stdbool.h substitute.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ChangeLog | 7 | ||||
-rw-r--r-- | lib/closeout.c | 10 |
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog index ee1f75283..4775458c0 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,4 +1,9 @@ -2006-02-02 Jim Meyering <jim@meyering.net> +2006-02-07 Paul Eggert <eggert@cs.ucla.edu> + + * closeout.c (close_stdout): Don't assume 'bool' converts nonzero + ints to 0 or 1, as this isn't true for the stdbool.h substitute. + +006-02-02 Jim Meyering <jim@meyering.net> Eliminate the unwelcome (albeit unlikely) possibility of xmalloc failure on deficient systems, and simplify gnulib lgpl dependencies. diff --git a/lib/closeout.c b/lib/closeout.c index 5d0509ded..2137fd4a3 100644 --- a/lib/closeout.c +++ b/lib/closeout.c @@ -1,7 +1,7 @@ /* closeout.c - close standard output - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software - Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2006 Free + Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -73,9 +73,9 @@ close_stdout_set_file_name (const char *file) void close_stdout (void) { - bool prev_fail = ferror (stdout); - bool none_pending = (0 == __fpending (stdout)); - bool fclose_fail = fclose (stdout); + bool none_pending = (__fpending (stdout) == 0); + bool prev_fail = (ferror (stdout) != 0); + bool fclose_fail = (fclose (stdout) != 0); if (prev_fail || fclose_fail) { |