This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
PATCH: Fix _IO_new_file_fopen build
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Cc: Ulrich Drepper <drepper at gmail dot com>
- Date: Mon, 16 May 2011 13:53:46 -0700
- Subject: PATCH: Fix _IO_new_file_fopen build
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
_IO_new_file_fopen won't build if __ASSUME_O_CLOEXEC is undefined.
This patch fixes it.
H.J.
---
2011-05-16 H.J. Lu <hongjiu.lu@intel.com>
* fileops.c (_IO_new_file_fopen): Get fd from _IO_fileno.
diff --git a/libio/fileops.c b/libio/fileops.c
index 2b696ab..30de460 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -348,6 +348,7 @@ _IO_new_file_fopen (fp, filename, mode, is32not64)
#ifndef __ASSUME_O_CLOEXEC
if ((fp->_flags2 & _IO_FLAGS2_CLOEXEC) != 0 && __have_o_cloexec <= 0)
{
+ int fd = _IO_fileno (fp);
if (__have_o_cloexec == 0)
{
int flags = __fcntl (fd, F_GETFD);