summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schuster <robertschuster@fsfe.org>2009-12-24 13:22:05 +0100
committerRobert Schuster <robertschuster@fsfe.org>2009-12-24 13:24:45 +0100
commite6c65635cb46bdad06c1d7a275995e11bee400a4 (patch)
treea00709e6065f0ac1748b9951e8702f58a5594fd3
parent9de37bd53586eebe5fe351f413f4888ce49debff (diff)
classpath: Added toolwrapper-exithook.patch
classpath-native: Dito.
-rw-r--r--recipes/classpath/files/toolwrapper-exithook.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/recipes/classpath/files/toolwrapper-exithook.patch b/recipes/classpath/files/toolwrapper-exithook.patch
new file mode 100644
index 0000000000..49b6631daf
--- /dev/null
+++ b/recipes/classpath/files/toolwrapper-exithook.patch
@@ -0,0 +1,46 @@
+Index: classpath-0.97.2/tools/toolwrapper.c
+===================================================================
+--- classpath-0.97.2.orig/tools/toolwrapper.c 2006-12-13 18:56:44.000000000 +0100
++++ classpath-0.97.2/tools/toolwrapper.c 2009-12-24 13:16:44.295000627 +0100
+@@ -59,6 +59,10 @@
+ /* Typedef for JNI_CreateJavaVM dlopen call. */
+ typedef jint createVM (JavaVM **, void **, void *);
+
++void exit_hook(jint);
++
++int return_code = 1;
++
+ int
+ main (int argc, const char** argv)
+ {
+@@ -143,6 +147,17 @@
+ vm_args.options[vm_args.nOptions++].optionString = "-Xbootclasspath/p:" TOOLS_ZIP;
+ }
+
++ /* Set the exit hook */
++ vm_args.options = (JavaVMOption*) realloc (vm_args.options, (vm_args.nOptions + 1) * sizeof (JavaVMOption));
++
++ if (vm_args.options == NULL)
++ {
++ fprintf (stderr, TOOLNAME ": realloc failed.\n");
++ goto destroy;
++ }
++ vm_args.options[vm_args.nOptions].optionString = "exit";
++ vm_args.options[vm_args.nOptions++].extraInfo = (void *) exit_hook;
++
+ /* Terminate vm_args.options with a NULL element. */
+ vm_args.options = (JavaVMOption*) realloc (vm_args.options, (vm_args.nOptions + 1) * sizeof (JavaVMOption));
+ if (vm_args.options == NULL)
+@@ -260,5 +275,11 @@
+ if (lt_dlexit () != 0)
+ fprintf (stderr, TOOLNAME ": lt_dlexit failed.\n");
+
+- return 1;
++ return return_code;
++}
++
++void exit_hook(jint code)
++{
++ return_code = code;
+ }
++