Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2007-01-18 22:58:36 +0000
committerAndrew Niefer2007-01-18 22:58:36 +0000
commit9bde46004175fdd3aa6557b9fdad82eae62f7085 (patch)
tree920035d710462a6ddefee94d1cc00aaf0f53b340 /bundles/org.eclipse.equinox.executable/library/motif
parent939aa45f31336d6f16a621bc801d479e39543e50 (diff)
downloadrt.equinox.framework-9bde46004175fdd3aa6557b9fdad82eae62f7085.tar.gz
rt.equinox.framework-9bde46004175fdd3aa6557b9fdad82eae62f7085.tar.xz
rt.equinox.framework-9bde46004175fdd3aa6557b9fdad82eae62f7085.zip
fix potential double free
Diffstat (limited to 'bundles/org.eclipse.equinox.executable/library/motif')
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c
index f63c84f4f..83b694e92 100644
--- a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c
+++ b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c
@@ -74,6 +74,9 @@ static const char* jvmLocations [] = { "j9vm",
extern XtAppContext appContext;
extern Widget topWindow;
+static pid_t jvmProcess = 0;
+static int jvmExitCode;
+
/* Define local variables for handling the splash window and its image. */
static Widget shellHandle = 0;
@@ -406,3 +409,37 @@ void restartLauncher( char* program, char* args[] )
/* just restart in-place */
execv(program, args);
}
+
+int launchJavaVM( char* args[] )
+{
+ int exitCode;
+
+#ifdef NETSCAPE_FIX
+ fixEnvForNetscape();
+#endif /* NETSCAPE_FIX */
+#ifdef MOZILLA_FIX
+ fixEnvForMozilla();
+#endif /* MOZILLA_FIX */
+
+ /* Create a child process for the JVM. */
+ jvmProcess = fork();
+ if (jvmProcess == 0)
+ {
+ /* Child process ... start the JVM */
+ execv( args[0], args );
+
+ /* The JVM would not start ... return error code to parent process. */
+ jvmExitCode = errno;
+ exit( jvmExitCode );
+ }
+
+ /* If the JVM is still running, wait for it to terminate. */
+ if (jvmProcess != 0)
+ {
+ wait( &exitCode );
+ jvmExitCode = ((exitCode & 0x00ff) == 0 ? (exitCode >> 8) : exitCode); /* see wait(2) */
+ }
+
+ /* Return the exit code from the JVM. */
+ return jvmExitCode;
+}

Back to the top