about summary refs log tree commit diff
path: root/libio/strops.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-07-07 18:29:30 +0000
committerUlrich Drepper <drepper@redhat.com>2007-07-07 18:29:30 +0000
commitc2c7bd3f865be02443c65e9a4e57b7d96cde145a (patch)
treead0701b8bfa0433293d95247e5b24730d7f23652 /libio/strops.c
parent765c6b0c46cc9406e912b4ead78cf587931e5156 (diff)
downloadglibc-c2c7bd3f865be02443c65e9a4e57b7d96cde145a.tar.gz
glibc-c2c7bd3f865be02443c65e9a4e57b7d96cde145a.tar.xz
glibc-c2c7bd3f865be02443c65e9a4e57b7d96cde145a.zip
[BZ #4745]
2007-07-07  Ulrich Drepper  <drepper@redhat.com>
	[BZ #4745]
	* libio/strops.c (_IO_str_underflow): Clear errno before returning
	EOF.
	* stdio-common/Makefile (tests): Add bug18.
	* stdio-common/bug18.c: New file.
Diffstat (limited to 'libio/strops.c')
-rw-r--r--libio/strops.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libio/strops.c b/libio/strops.c
index 05270ce407..c3222e0803 100644
--- a/libio/strops.c
+++ b/libio/strops.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997-2003, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997-2004, 2006, 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
@@ -166,7 +166,12 @@ _IO_str_underflow (fp)
   if (fp->_IO_read_ptr < fp->_IO_read_end)
     return *((unsigned char *) fp->_IO_read_ptr);
   else
-    return EOF;
+    {
+      /* We have to reset errno since callers check for errno being
+	 EINTR and there has been no such problem here.  */
+      __set_errno (0);
+      return EOF;
+    }
 }
 INTDEF(_IO_str_underflow)