From 5e4385b1c3e247570827112c7a4f94e078552c8c Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Tue, 12 Nov 2002 14:53:07 +0000 Subject: [PATCH] waitfor was return the pid instead of the exit value. --- .../library/spawner/spawner.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/core/org.eclipse.cdt.core.qnx/library/spawner/spawner.c b/core/org.eclipse.cdt.core.qnx/library/spawner/spawner.c index 88500444875..a6c1cef581f 100644 --- a/core/org.eclipse.cdt.core.qnx/library/spawner/spawner.c +++ b/core/org.eclipse.cdt.core.qnx/library/spawner/spawner.c @@ -224,8 +224,17 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise 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; }