This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix undeclared variable in glibc master fileops.c


On Mon, May 16, 2011 at 04:06:20PM -0700, Andi Kleen wrote:
> Since
> 
> commit 94b7cc3711b0b74c1d3ae18b9a2e019e51a8e0bf
> Author: Ulrich Drepper <drepper@gmail.com>
> Date:   Sun May 15 15:28:46 2011 -0400
> 
>     Fix a few problems in fopen and freopen
> 
> I need the following patch to compile glibc master on F14
> because fd is not defined.
> 
> -Andi
> 
> 2011-05-16  Andi Kleen  <ak@linux.intel.com>
> 
> 	* libio/fileops.c (_IO_new_file_fopen): Use fileno to access
> 	Unix file descriptor.

Or this is even better without build warnings:

diff --git a/libio/fileops.c b/libio/fileops.c
index 2b696ab..b783a3f 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -350,11 +350,11 @@ _IO_new_file_fopen (fp, filename, mode, is32not64)
     {
       if (__have_o_cloexec == 0)
 	{
-	  int flags = __fcntl (fd, F_GETFD);
+	  int flags = __fcntl (fp->_fileno, F_GETFD);
 	  __have_o_cloexec = (flags & FD_CLOEXEC) == 0 ? -1 : 1;
 	}
       if (__have_o_cloexec < 0)
-	__fcntl (fd, F_SETFD, FD_CLOEXEC);
+	__fcntl (fp->_fileno, F_SETFD, FD_CLOEXEC);
     }
 #endif
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]