[kaffe] CVS kaffe (guilhem): Fixed return code of kaffe-bin.

Kaffe CVS cvs-commits at kaffe.org
Tue Feb 15 02:49:53 PST 2005


PatchSet 5547 
Date: 2005/02/15 10:43:54
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Fixed return code of kaffe-bin.

Members: 
	ChangeLog:1.3591->1.3592 
	kaffe/kaffe/main.c:1.77->1.78 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3591 kaffe/ChangeLog:1.3592
--- kaffe/ChangeLog:1.3591	Tue Feb 15 09:34:20 2005
+++ kaffe/ChangeLog	Tue Feb 15 10:43:54 2005
@@ -1,3 +1,8 @@
+2005-02-15  Guilhem Lavaux  <guilhem at kaffe.org>
+
+	* kaffe/kaffe/main.c
+	(main2): If an exception happens, exit with a non-null value.
+
 2005-02-15  Jim Huang  <jserv at kaffe.org>
 
 	* include/jawt.h,
Index: kaffe/kaffe/kaffe/main.c
diff -u kaffe/kaffe/kaffe/main.c:1.77 kaffe/kaffe/kaffe/main.c:1.78
--- kaffe/kaffe/kaffe/main.c:1.77	Sat Feb  5 17:46:34 2005
+++ kaffe/kaffe/kaffe/main.c	Tue Feb 15 10:43:58 2005
@@ -265,6 +265,7 @@
 	jmethodID mmth;
 	jobject str;
 	int i;
+	int ret_code;
 	const char* exec;
 
 	/* make sure no compiler optimizes this away */
@@ -282,39 +283,45 @@
 	
 	mcls = (*env)->FindClass(env, exec);
 	if (checkException())
-		goto done;
+		goto exception_happened;
 	
 	/* ... and run main. */
 	mmth = (*env)->GetStaticMethodID(env,
 	    mcls, "main", "([Ljava/lang/String;)V");
 	if (checkException())
-		goto done;
+		goto exception_happened;
 
 	/* Build an array of strings as the arguments */
 	cls = (*env)->FindClass(env, "java/lang/String");
 	if (checkException())
-		goto done;
+		goto exception_happened;
 	args = (*env)->NewObjectArray(env, argc, cls, NULL);
 	if (checkException())
-		goto done;
+		goto exception_happened;
 	for (i = 0; i < argc; i++) {
 		str = (*env)->NewStringUTF(env, argv[farg+i]);
 		if (checkException())
-			goto done;
+			goto exception_happened;
 		(*env)->SetObjectArrayElement(env, args, i, str);
 		if (checkException())
-			goto done;
+			goto exception_happened;
 	}
 
 	/* Call method, check for errors and then exit */
 	(*env)->CallStaticVoidMethod(env, mcls, mmth, args);
-	(void)checkException();
+	if (checkException())
+	  goto exception_happened;
+
+	ret_code = 0;
+	goto done;
 
+exception_happened:
+	ret_code = 1;
 done:
 	/* We're done. We are the "main thread" and so are required to call
 	   (*vm)->DestroyJavaVM() instead of (*vm)->DetachCurrentThread() */
 	(*global_vm)->DestroyJavaVM(global_vm);
-	return (0);
+	return ret_code;
 }
 
 static int




More information about the kaffe mailing list