$OpenBSD: patch-jdk_src_solaris_native_java_lang_UNIXProcess_md_c,v 1.1 2013/02/01 15:34:35 kurt Exp $
--- jdk/src/solaris/native/java/lang/UNIXProcess_md.c.orig	Tue Jan 29 12:52:27 2013
+++ jdk/src/solaris/native/java/lang/UNIXProcess_md.c	Tue Jan 29 14:28:22 2013
@@ -86,6 +86,12 @@
 
 #define FAIL_FILENO (STDERR_FILENO + 1)
 
+#define RESTARTABLE(_cmd, _result) do { \
+  do { \
+    _result = _cmd; \
+  } while((_result == -1) && (errno == EINTR)); \
+} while(0)
+
 static void
 setSIGCHLDHandler(JNIEnv *env)
 {
@@ -327,19 +333,12 @@ jdk_fork_wrapper()
 #endif /* __FreeBSD__ */
 
 #if defined(__OpenBSD__)
-/*
- * Directly call _thread_sys_closefrom() so the child process
- * doesn't reset the parrent's file descriptors to be blocking.
- * This function is only called from the child process which
- * is single threaded and about to call execvp() so it is
- * safe to bypass the threaded closefrom().
- */
-int _thread_sys_closefrom(int);
-
 static int
 closeDescriptors(void)
 {
-    return _thread_sys_closefrom(FAIL_FILENO + 1);
+    int err;
+    RESTARTABLE(closefrom(FAIL_FILENO + 1), err);
+    return err;
 }
 
 #else
