From 3c1a29e2b8717a20948773bbc21abdc723ce5dee Mon Sep 17 00:00:00 2001 From: pacien Date: Sat, 24 Feb 2018 01:37:36 +0100 Subject: Handle daemon startup failures --- app/src/main/c/exec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/src/main/c') diff --git a/app/src/main/c/exec.c b/app/src/main/c/exec.c index d665341..5a76177 100644 --- a/app/src/main/c/exec.c +++ b/app/src/main/c/exec.c @@ -36,5 +36,7 @@ Java_org_pacien_tincapp_commands_Executor_forkExec(JNIEnv *env, jclass class, jo JNIEXPORT jint JNICALL Java_org_pacien_tincapp_commands_Executor_wait(JNIEnv *env, jclass class, jint pid) { - return waitpid(pid, NULL, 0); + int status; + waitpid(pid, &status, 0); + return WIFEXITED(status) ? WEXITSTATUS(status) : -1; } -- cgit v1.2.3