X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=lib%2Ferror.c;h=af2287b2713eaf792093e27adf7d7beeac99ac30;hp=3177bd5d2cbc3802e3590e40732ca6c376762a31;hb=cb555a94fa5188122569ed3803c463f27ccd0261;hpb=992e3169e28a23b6899433768dcd4302553b31c3 diff --git a/lib/error.c b/lib/error.c index 3177bd5d..af2287b2 100644 --- a/lib/error.c +++ b/lib/error.c @@ -1,5 +1,5 @@ /* Error handler for noninteractive utilities - Copyright (C) 1990-1998, 2000-2007 Free Software Foundation, Inc. + Copyright (C) 1990-1998, 2000-2007, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -85,6 +85,8 @@ extern void __error_at_line (int status, int errnum, const char *file_name, #else /* not _LIBC */ +# include + # if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P # ifndef HAVE_DECL_STRERROR_R "this configure-time declaration test was not run" @@ -236,6 +238,12 @@ error (int status, int errnum, const char *message, ...) 0); #endif +#if !_LIBC && defined F_GETFL + /* POSIX states that fflush (stdout) after fclose is unspecified; it + is safe in glibc, but not on all other platforms. fflush (NULL) + is always defined, but too draconian. */ + if (0 <= fcntl (1, F_GETFL)) +#endif fflush (stdout); #ifdef _LIBC _IO_flockfile (stderr); @@ -295,6 +303,12 @@ error_at_line (int status, int errnum, const char *file_name, 0); #endif +#if !_LIBC && defined F_GETFL + /* POSIX states that fflush (stdout) after fclose is unspecified; it + is safe in glibc, but not on all other platforms. fflush (NULL) + is always defined, but too draconian. */ + if (0 <= fcntl (1, F_GETFL)) +#endif fflush (stdout); #ifdef _LIBC _IO_flockfile (stderr);