* runtime/main.c (store_exe_path): Don't crash if argv0 is NULL.
authorAdam Nemet <anemet@caviumnetworks.com>
Sat, 6 Dec 2008 18:07:43 +0000 (18:07 +0000)
committerAdam Nemet <nemet@gcc.gnu.org>
Sat, 6 Dec 2008 18:07:43 +0000 (18:07 +0000)
From-SVN: r142526

libgfortran/ChangeLog
libgfortran/runtime/main.c

index 7aba0260ccd1d63f847c931ae9ef685ee9d6c31d..3fc0ca8228847c8828afe6185896205b5b8395df 100644 (file)
@@ -1,3 +1,7 @@
+2008-12-06  Adam Nemet  <anemet@caviumnetworks.com>
+
+       * runtime/main.c (store_exe_path): Don't crash if argv0 is NULL.
+
 2008-12-05  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR libfortran/38291
index 71b481a7deb1a94b38963138cbb5985314be4921..947b3985238ec83794b093e652ce191083731aa0 100644 (file)
@@ -111,7 +111,8 @@ store_exe_path (const char * argv0)
 
   char buf[PATH_MAX], *cwd, *path;
 
-  if (argv0[0] == '/')
+  /* On the simulator argv is not set.  */
+  if (argv0 == NULL || argv0[0] == '/')
     {
       exe_path = argv0;
       please_free_exe_path_when_done = 0;