Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2008-05-09 19:49:43 +0000
committerAndrew Niefer2008-05-09 19:49:43 +0000
commitd57c5b75d829e0a47668eca9cb81382dda778821 (patch)
tree0f43d248b8c7f188234cc2dfc42c6a5b66b50ad7 /bundles
parenta9049f67902ad98d4fafbb721a73c29c806af6c8 (diff)
downloadrt.equinox.framework-d57c5b75d829e0a47668eca9cb81382dda778821.tar.gz
rt.equinox.framework-d57c5b75d829e0a47668eca9cb81382dda778821.tar.xz
rt.equinox.framework-d57c5b75d829e0a47668eca9cb81382dda778821.zip
bug 195897 - fix compiling on aix
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.executable/library/eclipseNix.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseNix.c b/bundles/org.eclipse.equinox.executable/library/eclipseNix.c
index cdbc29699..a078101d5 100644
--- a/bundles/org.eclipse.equinox.executable/library/eclipseNix.c
+++ b/bundles/org.eclipse.equinox.executable/library/eclipseNix.c
@@ -174,17 +174,19 @@ int startJavaVM( _TCHAR* libPath, _TCHAR* vmArgs[], _TCHAR* progArgs[], _TCHAR*
}
int isSunVM( _TCHAR * javaVM, _TCHAR * jniLib ) {
+ int descriptors[2];
+ int result = 0;
+ int pid = -1;
+
if (javaVM == NULL)
return 0;
- int descriptors[2];
- int result = 0;
/* create pipe, [0] is read end, [1] is write end */
if (pipe(descriptors) != 0)
return 0; /* error */
- int pid = fork();
- if (pid == 0 ) {
+ pid = fork();
+ if (pid == 0 ) {
/* child, connect stdout & stderr to write end of the pipe*/
dup2(descriptors[1], STDERR_FILENO);
dup2(descriptors[1], STDOUT_FILENO);
@@ -193,15 +195,18 @@ int isSunVM( _TCHAR * javaVM, _TCHAR * jniLib ) {
close(descriptors[0]);
close(descriptors[1]);
- /* exec java -version */
- _TCHAR *args [] = { javaVM, _T_ECLIPSE("-version"), NULL };
- execv(args[0], args);
- /* if we make it here, there was a problem with exec, just exit */
- exit(0);
+ {
+ /* exec java -version */
+ _TCHAR *args [] = { javaVM, _T_ECLIPSE("-version"), NULL };
+ execv(args[0], args);
+ /* if we make it here, there was a problem with exec, just exit */
+ exit(0);
+ }
} else if (pid > 0){
/* parent */
+ FILE * stream = NULL;
close(descriptors[1]);
- FILE * stream = fdopen( descriptors[0], "r");
+ stream = fdopen( descriptors[0], "r");
if (stream != NULL) {
_TCHAR buffer[256];
while ( fgets(buffer, 256, stream) != NULL) {

Back to the top