From c4a710b6b00590e2a4d852beea72cd5a69d3a7bb Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 26 Jul 2008 23:42:14 +0000 Subject: [PATCH] [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. --- ChangeLog | 5 +++++ libio/fileops.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 162bbae..df99b84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2008-07-26 Ulrich Drepper + [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. + * sunrpc/key_call.c (getkeyserv_handle): Use FD_CLOEXEC instead of magic number. diff --git a/libio/fileops.c b/libio/fileops.c index 95cd2d6..f5b25699 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 . @@ -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) -- 2.7.4