From: Andreas Jaeger <aj@suse.de>
To: libc-hacker@sources.redhat.com
Subject: Fix fopen (non-existing-file, "re") errno
Date: Fri, 19 Aug 2011 13:41:00 -0000 [thread overview]
Message-ID: <201108191541.37620.aj@suse.de> (raw)
[-- 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)
reply other threads:[~2011-08-19 13:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201108191541.37620.aj@suse.de \
--to=aj@suse.de \
--cc=libc-hacker@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).