aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--NEWS4
-rw-r--r--libio/filedoalloc.c17
-rw-r--r--stdio-common/perror.c7
-rw-r--r--stdio-common/vfprintf.c1
5 files changed, 33 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 3b334c5..1337663 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-05-21 Ulrich Drepper <drepper@gmail.com>
+
+ [BZ #12792]
+ * libio/filedoalloc.c (local_isatty): New function.
+ (_IO_file_doallocate): Use local_isatty.
+ * stdio-common/perror.c (perror): In case a new stream is used
+ forward the stream error.
+ * stdio-common/vfprintf.c (ARGCHECK): For read-only streams also set
+ error flag.
+
2011-05-20 Ulrich Drepper <drepper@gmail.com>
[BZ #11869]
diff --git a/NEWS b/NEWS
index d7833e9..ca0ee8f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes. 2011-5-20
+GNU C Library NEWS -- history of user-visible changes. 2011-5-21
Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
See the end for copying conditions.
@@ -16,7 +16,7 @@ Version 2.14
12454, 12460, 12469, 12489, 12509, 12510, 12511, 12518, 12527, 12541,
12545, 12551, 12582, 12583, 12587, 12597, 12601, 12611, 12625, 12626,
12631, 12650, 12653, 12655, 12660, 12681, 12685, 12711, 12713, 12714,
- 12717, 12723, 12724, 12734, 12738, 12746, 12766, 12775
+ 12717, 12723, 12724, 12734, 12738, 12746, 12766, 12775, 12792
* The RPC implementation in libc is obsoleted. Old programs keep working
but new programs cannot be linked with the routines in libc anymore.
diff --git a/libio/filedoalloc.c b/libio/filedoalloc.c
index ca02dbe..4f62dcd 100644
--- a/libio/filedoalloc.c
+++ b/libio/filedoalloc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997, 2001, 2002, 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
@@ -41,7 +41,7 @@
4. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -74,6 +74,17 @@
# include <device-nrs.h>
#endif
+
+static int
+local_isatty (int fd)
+{
+ int save_errno = errno;
+ int res = isatty (fd);
+ __set_errno (save_errno);
+ return res;
+}
+
+
/*
* Allocate a file buffer, or switch to unbuffered I/O.
* Per the ANSI C standard, ALL tty devices default to line buffered.
@@ -109,7 +120,7 @@ _IO_file_doallocate (fp)
#ifdef DEV_TTY_P
DEV_TTY_P (&st) ||
#endif
- isatty (fp->_fileno))
+ local_isatty (fp->_fileno))
fp->_flags |= _IO_LINE_BUF;
}
#if _IO_HAVE_ST_BLKSIZE
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);
}
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index cfa4c30..753a5ac 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -52,6 +52,7 @@
CHECK_FILE (S, -1); \
if (S->_flags & _IO_NO_WRITES) \
{ \
+ S->_flags |= _IO_ERR_SEEN; \
__set_errno (EBADF); \
return -1; \
} \