summaryrefslogtreecommitdiff
path: root/tests/error.c
diff options
context:
space:
mode:
authorAndreas Rottmann <a.rottmann@gmx.at>2009-09-14 12:34:39 +0200
committerAndreas Rottmann <a.rottmann@gmx.at>2009-09-14 12:34:39 +0200
commit79ca645d222db2e158784642c3b464a47bea26f3 (patch)
tree73fa0e7f2f509013ca7ea3395b268c8471b2355b /tests/error.c
parent8a927bfd7da41dbe61f3cfeaccbd37c761c0bc36 (diff)
parent3bebb94360f1c2333feb8d504a9fa4f96984d8b7 (diff)
Merge commit 'upstream/0.9.1.1'
Diffstat (limited to 'tests/error.c')
-rw-r--r--tests/error.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/error.c b/tests/error.c
index 3177bd5..af2287b 100644
--- a/tests/error.c
+++ b/tests/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 <fcntl.h>
+
# 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);