X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fclose-stream.c;h=04fa5ece09d77267af8afb8bcc85c7a9edd246dd;hb=86627bb14a123f183bd094e582e4cd9f2aca489a;hp=f71eaeffe40b078e3f4032aed12ae837c90b3f71;hpb=441aa3044f43e5572f58c354f01e6bc070acd5c7;p=gnulib.git diff --git a/lib/close-stream.c b/lib/close-stream.c index f71eaeffe..04fa5ece0 100644 --- a/lib/close-stream.c +++ b/lib/close-stream.c @@ -1,7 +1,6 @@ /* Close a stream, with nicer error checking than fclose's. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2006, 2007, 2008 Free - Software Foundation, Inc. + Copyright (C) 1998-2002, 2004, 2006-2012 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 @@ -56,15 +55,15 @@ int close_stream (FILE *stream) { - bool some_pending = (__fpending (stream) != 0); - bool prev_fail = (ferror (stream) != 0); - bool fclose_fail = (fclose (stream) != 0); + const bool some_pending = (__fpending (stream) != 0); + const bool prev_fail = (ferror (stream) != 0); + const bool fclose_fail = (fclose (stream) != 0); /* Return an error indication if there was a previous failure or if fclose failed, with one exception: ignore an fclose failure if there was no previous error, no data remains to be flushed, and fclose failed with EBADF. That can happen when a program like cp - is invoked like this `cp a b >&-' (i.e., with standard output + is invoked like this 'cp a b >&-' (i.e., with standard output closed) and doesn't generate any output (hence no previous error and nothing to be flushed). */