* Fix fopen (non-existing-file, "re") errno
@ 2011-08-19 13:41 Andreas Jaeger
0 siblings, 0 replies; only message in thread
From: Andreas Jaeger @ 2011-08-19 13:41 UTC (permalink / raw)
To: libc-hacker
[-- Attachment #1: Type: Text/Plain, Size: 664 bytes --]
errno was set to EBADF with a call to fopen (non-existing-file, "re") instead
of ENOENT. The problem was a missing check. Fixed with the appended patch,
Andreas
2011-08-19 Andreas Jaeger <aj@suse.de>
[BZ #13114]
* libio/fileops.c (_IO_new_file_fopen): Fix handling of
non-existant file when using closeexec mode.
--
Andreas Jaeger, Program Manager openSUSE
aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
[-- Attachment #2: diff --]
[-- Type: text/x-patch, Size: 487 bytes --]
diff --git a/libio/fileops.c b/libio/fileops.c
index 30de460..6d9b52d 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -346,7 +346,8 @@ _IO_new_file_fopen (fp, filename, mode, is32not64)
is32not64);
#ifndef __ASSUME_O_CLOEXEC
- if ((fp->_flags2 & _IO_FLAGS2_CLOEXEC) != 0 && __have_o_cloexec <= 0)
+ if ((result != NULL)
+ && (fp->_flags2 & _IO_FLAGS2_CLOEXEC) != 0 && __have_o_cloexec <= 0)
{
int fd = _IO_fileno (fp);
if (__have_o_cloexec == 0)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-08-19 13:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-19 13:41 Fix fopen (non-existing-file, "re") errno Andreas Jaeger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).