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
+6
View File
@@ -127,6 +127,9 @@
/* Define to 1 if you have the `getpwuid_r' function. */
#undef HAVE_GETPWUID_R
/* Define to 1 if you have the `getrlimit' function. */
#undef HAVE_GETRLIMIT
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
@@ -316,6 +319,9 @@
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
/* Define to 1 if you have the <sys/rw_lock.h> header file. */
#undef HAVE_SYS_RW_LOCK_H
-9
View File
@@ -98,15 +98,6 @@ extern jlong _Jv_platform_nanotime ();
extern void _Jv_platform_initialize (void);
extern void _Jv_platform_initProperties (java::util::Properties*);
inline void
_Jv_platform_close_on_exec (jint fd)
{
// Ignore errors.
::fcntl (fd, F_SETFD, FD_CLOEXEC);
}
#undef fcntl
#ifdef JV_HASH_SYNCHRONIZATION
#ifndef HAVE_USLEEP_DECL
extern "C" int usleep (useconds_t useconds);