Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Fix Pr 26005

 
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.qnx/ChangeLog,v
retrieving revision 1.4
diff -u -r1.4 ChangeLog
--- ChangeLog	4 Nov 2002 20:44:32 -0000	1.4
+++ ChangeLog	12 Nov 2002 14:52:04 -0000
@@ -1,3 +1,12 @@
+2002-11-12 Alain Magloire
+
+	Fix Pr 26005
+	* library/spawner/spawner.c (waitFor):
+	The waitFor(int) JNI on QNX is returning the PID of the
+	process rather then the status of the process
+	on exit.
+	Patch from Chris Mckillop.
+
 2002-11-04 Alain Magloire
 
 	* library/pty/pty.c: New file.
Index: library/spawner/spawner.c
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.qnx/library/spawner/spawner.c,v
retrieving revision 1.1
diff -u -r1.1 spawner.c
--- library/spawner/spawner.c	4 Nov 2002 20:57:06 -0000	1.1
+++ library/spawner/spawner.c	12 Nov 2002 14:52:04 -0000
@@ -224,8 +224,17 @@
 JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor
   (JNIEnv * env, jobject proc, jint pid)
 {
-	int stat_loc;
-	return (waitpid(pid, &stat_loc, WEXITED));
+	int ret;
+	int val = -1;
+
+	ret = waitpid(pid, &stat_loc, WEXITED);
+	if (ret == -1 && errno == EINTR) {
+		// Throw an exception here.
+	}
+	if (WIFEXITED(stat_loc)) {
+		val = WEXITSTATUS(stat_loc);
+	}
+	return val;
 }



Back to the top