aboutsummaryrefslogtreecommitdiff
path: root/stdio-common/perror.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-05-21 00:42:06 -0400
committerUlrich Drepper <drepper@gmail.com>2011-05-21 00:42:06 -0400
commitaec84f53952315ac1bd91036e37113d9cb3a303b (patch)
treec14c6c1a134a245094506dad430c951493b2eeed /stdio-common/perror.c
parent34a9094f49241ebb72084c536cf468fd51ebe3ec (diff)
downloadglibc-aec84f53952315ac1bd91036e37113d9cb3a303b.zip
glibc-aec84f53952315ac1bd91036e37113d9cb3a303b.tar.gz
glibc-aec84f53952315ac1bd91036e37113d9cb3a303b.tar.bz2
Set stream errors in more cases
Also avoid unnecessarily setting errno when testing for TTY.
Diffstat (limited to 'stdio-common/perror.c')
-rw-r--r--stdio-common/perror.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/stdio-common/perror.c b/stdio-common/perror.c
index 3ee6152..dedc922 100644
--- a/stdio-common/perror.c
+++ b/stdio-common/perror.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991-1993,1997,1998,2000-2005 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993,1997,1998,2000-2005,2011
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -73,6 +74,10 @@ perror (const char *s)
position. Since the stderr stream wasn't used so far we just
write to the descriptor. */
perror_internal (fp, s, errnum);
+
+ if (_IO_ferror_unlocked (fp))
+ stderr->_flags |= _IO_ERR_SEEN;
+
/* Close the stream. */
fclose (fp);
}