aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/runtime/main.c
diff options
context:
space:
mode:
authorJanne Blomqvist <jb@gcc.gnu.org>2012-01-11 09:34:16 +0200
committerJanne Blomqvist <jb@gcc.gnu.org>2012-01-11 09:34:16 +0200
commit87633176610f86df377de7362ebb081394815733 (patch)
treeb5f05dd66b706344b7b79599c6f1030525dab0c1 /libgfortran/runtime/main.c
parentef1ed13d9ab2e2c9dacdb5ae06afb86ca6ad7193 (diff)
downloadgcc-87633176610f86df377de7362ebb081394815733.zip
gcc-87633176610f86df377de7362ebb081394815733.tar.gz
gcc-87633176610f86df377de7362ebb081394815733.tar.bz2
PR 51803 Handle getcwd failure and lack of the function better.
2012-01-11 Janne Blomqvist <jb@gcc.gnu.org> Mike Stump <mikestump@comcast.net> PR libfortran/51803 * runtime/main.c (store_exe_path): Handle getcwd failure and lack of the function better. Co-Authored-By: Mike Stump <mikestump@comcast.net> From-SVN: r183090
Diffstat (limited to 'libgfortran/runtime/main.c')
-rw-r--r--libgfortran/runtime/main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libgfortran/runtime/main.c b/libgfortran/runtime/main.c
index 11b535a..1cad5ef 100644
--- a/libgfortran/runtime/main.c
+++ b/libgfortran/runtime/main.c
@@ -116,8 +116,10 @@ store_exe_path (const char * argv0)
memset (buf, 0, sizeof (buf));
#ifdef HAVE_GETCWD
cwd = getcwd (buf, sizeof (buf));
+ if (!cwd)
+ cwd = ".";
#else
- cwd = "";
+ cwd = ".";
#endif
/* exe_path will be cwd + "/" + argv[0] + "\0". This will not work