glibc/fopen-close-exec.patch

15 lines
524 B
Diff

Index: glibc-2.14/libio/fileops.c
===================================================================
--- glibc-2.14.orig/libio/fileops.c
+++ glibc-2.14/libio/fileops.c
@@ -338,7 +338,8 @@ _IO_new_file_fopen (fp, filename, mode,
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)