src/java.base/unix/native/libjli/java_md_solinux.c
changeset 54023 a764c49570c6
parent 53941 f9302cf718c9
child 58280 ef8c8cf9256a
equal deleted inserted replaced
54022:ff399127078a 54023:a764c49570c6
   301     int argc = *pargc;
   301     int argc = *pargc;
   302     char **argv = *pargv;
   302     char **argv = *pargv;
   303 
   303 
   304 #ifdef SETENV_REQUIRED
   304 #ifdef SETENV_REQUIRED
   305     jboolean mustsetenv = JNI_FALSE;
   305     jboolean mustsetenv = JNI_FALSE;
       
   306 #ifdef __solaris__
       
   307     char *llp64 = NULL; /* existing LD_LIBRARY_PATH_64 setting */
       
   308 #endif // __solaris__
   306     char *runpath = NULL; /* existing effective LD_LIBRARY_PATH setting */
   309     char *runpath = NULL; /* existing effective LD_LIBRARY_PATH setting */
   307     char* new_runpath = NULL; /* desired new LD_LIBRARY_PATH string */
   310     char* new_runpath = NULL; /* desired new LD_LIBRARY_PATH string */
   308     char* newpath = NULL; /* path on new LD_LIBRARY_PATH */
   311     char* newpath = NULL; /* path on new LD_LIBRARY_PATH */
   309     char* lastslash = NULL;
   312     char* lastslash = NULL;
   310     char** newenvp = NULL; /* current environment */
   313     char** newenvp = NULL; /* current environment */
   365          *
   368          *
   366          * followed by the user's previous effective LD_LIBRARY_PATH, if
   369          * followed by the user's previous effective LD_LIBRARY_PATH, if
   367          * any.
   370          * any.
   368          */
   371          */
   369 
   372 
       
   373 #ifdef __solaris__
       
   374         llp64 = getenv("LD_LIBRARY_PATH_64");
       
   375         runpath = (llp64 == NULL) ? getenv(LD_LIBRARY_PATH) : llp64;
       
   376 #else
   370         runpath = getenv(LD_LIBRARY_PATH);
   377         runpath = getenv(LD_LIBRARY_PATH);
       
   378 #endif /* __solaris__ */
   371 
   379 
   372         /* runpath contains current effective LD_LIBRARY_PATH setting */
   380         /* runpath contains current effective LD_LIBRARY_PATH setting */
   373         { /* New scope to declare local variable */
   381         { /* New scope to declare local variable */
   374             char *new_jvmpath = JLI_StringDup(jvmpath);
   382             char *new_jvmpath = JLI_StringDup(jvmpath);
   375             new_runpath_size = ((runpath != NULL) ? JLI_StrLen(runpath) : 0) +
   383             new_runpath_size = ((runpath != NULL) ? JLI_StrLen(runpath) : 0) +
   438         /*
   446         /*
   439          * Unix systems document that they look at LD_LIBRARY_PATH only
   447          * Unix systems document that they look at LD_LIBRARY_PATH only
   440          * once at startup, so we have to re-exec the current executable
   448          * once at startup, so we have to re-exec the current executable
   441          * to get the changed environment variable to have an effect.
   449          * to get the changed environment variable to have an effect.
   442          */
   450          */
       
   451 #ifdef __solaris__
       
   452         /*
       
   453          * new LD_LIBRARY_PATH took over for LD_LIBRARY_PATH_64
       
   454          */
       
   455         if (llp64 != NULL) {
       
   456             UnsetEnv("LD_LIBRARY_PATH_64");
       
   457         }
       
   458 #endif // __solaris__
   443 
   459 
   444         newenvp = environ;
   460         newenvp = environ;
   445     }
   461     }
   446 #endif /* SETENV_REQUIRED */
   462 #endif /* SETENV_REQUIRED */
   447     {
   463     {