diff options
author | Ulrich Drepper <drepper@redhat.com> | 2008-07-26 23:42:14 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2008-07-26 23:42:14 +0000 |
commit | c4a710b6b00590e2a4d852beea72cd5a69d3a7bb (patch) | |
tree | f91461f899ddd7b18d32a68c9ad9d3ba7f3c0981 /libio/fileops.c | |
parent | 31f3b159e3cb07c2733fd7662da6f1abd689ee3f (diff) | |
download | glibc-c4a710b6b00590e2a4d852beea72cd5a69d3a7bb.tar glibc-c4a710b6b00590e2a4d852beea72cd5a69d3a7bb.tar.gz glibc-c4a710b6b00590e2a4d852beea72cd5a69d3a7bb.tar.bz2 glibc-c4a710b6b00590e2a4d852beea72cd5a69d3a7bb.zip |
[BZ #6771]
* libio/fileops.c (_IO_new_file_attach): Preserve errno around
success call of _IO_SEEKOFF or calls which failed because the
descriptor is for a pipe.
Diffstat (limited to 'libio/fileops.c')
-rw-r--r-- | libio/fileops.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libio/fileops.c b/libio/fileops.c index 95cd2d64c9..f5b256998d 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1995, 1997-2005, 2006, 2007 +/* Copyright (C) 1993, 1995, 1997-2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Per Bothner <bothner@cygnus.com>. @@ -428,9 +428,11 @@ _IO_new_file_attach (fp, fd) /* Get the current position of the file. */ /* We have to do that since that may be junk. */ fp->_offset = _IO_pos_BAD; + int save_errno = errno; if (_IO_SEEKOFF (fp, (_IO_off64_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD && errno != ESPIPE) return NULL; + errno = save_errno; return fp; } INTDEF2(_IO_new_file_attach, _IO_file_attach) |