[Patch] PR 31228, Fix close-on-exec race.

David Daney ddaney@avtrex.com
Fri Mar 23 01:16:00 GMT 2007


David Daney wrote:
> Attached is what I ended up committing.
> 
> The only difference from the original patch is that I use the rlim_max 
> value instead of the flim_cur value.  This will yield the same result 
> unless someone has been doing funny things with the limit.  In which 
> case we should use the rlim_max value in case there are any vestigial 
> descriptors left open above the current limit.
> 
> Tested on x86_64-pc-linux-gnu (FC6) with no regressions found.
> 
> 2007-03-22  David Daney  <ddaney@avtrex.com>
> 
>    PR libgcj/31228
>    * configure.ac: Add checks for getrlimit and sys/resource.h.
>    * include/posix.h (_Jv_platform_close_on_exec): Remove.
>    * include/config.h.in: Regenerate.
>    * configure: Regenerate.
>    * gnu/java/nio/channels/natFileChannelPosix.cc (open): Remove call to
>    _Jv_platform_close_on_exec;
>    * gnu/java/net/natPlainSocketImplPosix.cc (create): Likewise.
>    (accept): Likewise.
>    * gnu/java/net/natPlainDatagramSocketImplPosix.cc (create):Likewise.
>    * java/lang/natPosixProcess.cc: Include sys/resource.h.
>    (nativeSpawn): Close all file descriptors.  Don't set FD_CLOEXEC on
>    pipes.

Should I put this on the 4.2 branch as well?  If you think it is a good 
idea, I will.

David Daney.




More information about the Java-patches mailing list