aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorAdam Nemet <anemet@caviumnetworks.com>2008-12-06 18:07:43 +0000
committerAdam Nemet <nemet@gcc.gnu.org>2008-12-06 18:07:43 +0000
commit8b86bdbc02cddb4d8948380d46add28ea979f289 (patch)
tree4ddede01a23b706662acf3101fcc2838b4975280 /libgfortran
parent230f3755634a2506c5c9fcc2be03faa86616796f (diff)
downloadgcc-8b86bdbc02cddb4d8948380d46add28ea979f289.zip
gcc-8b86bdbc02cddb4d8948380d46add28ea979f289.tar.gz
gcc-8b86bdbc02cddb4d8948380d46add28ea979f289.tar.bz2
* runtime/main.c (store_exe_path): Don't crash if argv0 is NULL.
From-SVN: r142526
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog4
-rw-r--r--libgfortran/runtime/main.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 7aba026..3fc0ca8 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -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
diff --git a/libgfortran/runtime/main.c b/libgfortran/runtime/main.c
index 71b481a..947b398 100644
--- a/libgfortran/runtime/main.c
+++ b/libgfortran/runtime/main.c
@@ -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;