From 5b85520f758d0a96694e6fd0b02256a29cda7f82 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Thu, 3 May 2012 12:17:12 +0930 Subject: [PATCH] Fix JNI command-line interface; return 255 instead of -1 --- commandline.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commandline.c b/commandline.c index 278f86ec..a6056aff 100644 --- a/commandline.c +++ b/commandline.c @@ -148,7 +148,7 @@ JNIEXPORT jint JNICALL Java_org_servalproject_servald_ServalD_rawCommand(JNIEnv { jclass stringClass = NULL; jclass listClass = NULL; - jint status = 0; + unsigned char status = 0; // to match what the shell gets: 0..255 // Enforce non re-entrancy. if (jni_env) { jclass exceptionClass = NULL; @@ -213,7 +213,7 @@ JNIEXPORT jint JNICALL Java_org_servalproject_servald_ServalD_rawCommand(JNIEnv // Deal with Java exceptions: NewStringUTF out of memory in outv_end_field(). if (jni_exception || (outv_current != outv_buffer && outv_end_field() == -1)) return -1; - return status; + return (jint) status; } #endif /* HAVE_JNI_H */