You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2007/01/23 22:53:09 UTC

svn commit: r499147 - /harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/shared/hyport.c

Author: hindessm
Date: Tue Jan 23 13:53:08 2007
New Revision: 499147

URL: http://svn.apache.org/viewvc?view=rev&rev=499147
Log:
Fix to stop initialization of portlib from segfaulting.  This really
needs fixing properly.

Modified:
    harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/shared/hyport.c

Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/shared/hyport.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/shared/hyport.c?view=diff&rev=499147&r1=499146&r2=499147
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/shared/hyport.c (original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/shared/hyport.c Tue Jan 23 13:53:08 2007
@@ -549,15 +549,22 @@
   char *launcherName = NULL;
 
   hysysinfo_get_executable_name (portLib, NULL, &launcherName);
-  endPathPtr = strrchr (launcherName, DIR_SEPARATOR);
-  endPathPtr[1] = '\0';
-  // launcherName now holds the name of the launcher's home directory
+
+  if (launcherName == NULL) { 
+    /* TOFIX: This is really a hack to work around the fact that the
+     * hysysinfo_get_executable_name function currently only works
+     * when argv[0] is passed (not NULL as above) and/or when running
+     * on Linux (with /proc mounted).
+     */
+    portLib->nls_set_catalog (portLib, (const char **) NULL, 0, "harmony", "properties");
+  } else {
+    endPathPtr = strrchr (launcherName, DIR_SEPARATOR);
+    endPathPtr[1] = '\0';
+    // launcherName now holds the name of the launcher's home directory
   
-  portLib->nls_set_catalog (portLib, (const char **) &launcherName, 1, "harmony", "properties");
+    portLib->nls_set_catalog (portLib, (const char **) &launcherName, 1, "harmony", "properties");
 
-  // Free memory for launcherName -- necessary ??
-  if (launcherName)
-    {
-      portLib->mem_free_memory (portLib, launcherName);
-    }
+    // Free memory for launcherName -- necessary ??
+    portLib->mem_free_memory (portLib, launcherName);
+  }
 }