aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-10-13 07:11:11 +0000
committerUlrich Drepper <drepper@redhat.com>2007-10-13 07:11:11 +0000
commit0ea4967708e69a518d7a141ebab328e6d58b5401 (patch)
tree84a2508bbec4f8008bf1fc5a5c2000582915c857
parentfab1a490acd7a6abefc37f94615001ab8cb83ae8 (diff)
downloadglibc-0ea4967708e69a518d7a141ebab328e6d58b5401.zip
glibc-0ea4967708e69a518d7a141ebab328e6d58b5401.tar.gz
glibc-0ea4967708e69a518d7a141ebab328e6d58b5401.tar.bz2
[BZ #4359]
2007-10-13 Ulrich Drepper <drepper@redhat.com> [BZ #4359] * libio/__freading.c (__freading): Don't return true for write-only streams.
-rw-r--r--ChangeLog6
-rw-r--r--libio/__freading.c7
2 files changed, 10 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 6b89367..3a16e6a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-10-13 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #4359]
+ * libio/__freading.c (__freading): Don't return true for
+ write-only streams.
+
2007-10-12 Ulrich Drepper <drepper@redhat.com>
* locale/programs/repertoire.c (repertoire_read): Always free
diff --git a/libio/__freading.c b/libio/__freading.c
index 37200bb..7eca27b 100644
--- a/libio/__freading.c
+++ b/libio/__freading.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2002, 2007 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
@@ -21,6 +21,7 @@
int
__freading (FILE *fp)
{
- return ((fp->_flags & _IO_NO_WRITES)
- || (fp->_flags & _IO_CURRENTLY_PUTTING) == 0);
+ return (((fp->_flags & _IO_NO_WRITES)
+ || (fp->_flags & _IO_CURRENTLY_PUTTING) == 0)
+ && (fp->_flags & _IO_NO_READS) == 0);
}