re PR libgcj/31228 (Race condition between setting close-on-exec and Runtime.exec())

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.

From-SVN: r123138
This commit is contained in:
David Daney 2007-03-23 00:06:41 +00:00 committed by David Daney
parent 92ef5cf999
commit 46ecc2bc5c
9 changed files with 56 additions and 30 deletions

View file

@ -83,8 +83,6 @@ gnu::java::net::PlainDatagramSocketImpl::create ()
throw new ::java::net::SocketException (JvNewStringUTF (strerr));
}
_Jv_platform_close_on_exec (sock);
// We use native_fd in place of fd here. From leaving fd null we avoid
// the double close problem in FileDescriptor.finalize.
native_fd = sock;

View file

@ -72,8 +72,6 @@ gnu::java::net::PlainSocketImpl::create (jboolean stream)
throw new ::java::io::IOException (JvNewStringUTF (strerr));
}
_Jv_platform_close_on_exec (sock);
// We use native_fd in place of fd here. From leaving fd null we avoid
// the double close problem in FileDescriptor.finalize.
native_fd = sock;
@ -285,8 +283,6 @@ gnu::java::net::PlainSocketImpl::accept (gnu::java::net::PlainSocketImpl *s)
if (new_socket < 0)
goto error;
_Jv_platform_close_on_exec (new_socket);
jbyteArray raddr;
jint rport;
if (u.address.sin_family == AF_INET)

View file

@ -178,8 +178,6 @@ FileChannelImpl::open (jstring path, jint jflags)
throw new ::java::io::FileNotFoundException (msg->toString ());
}
_Jv_platform_close_on_exec (fd);
return fd;
}