summaryrefslogtreecommitdiff
path: root/libgfortran/runtime
diff options
context:
space:
mode:
authorjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2012-01-11 07:34:16 +0000
committerjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2012-01-11 07:34:16 +0000
commitc877b3746f02f0f3fc36ec5da65ffa8475e12fae (patch)
treeb5f05dd66b706344b7b79599c6f1030525dab0c1 /libgfortran/runtime
parent927a01eba66c97c810b74e48669832863c8b846d (diff)
downloadgcc-c877b3746f02f0f3fc36ec5da65ffa8475e12fae.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183090 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/runtime')
-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 11b535afa92..1cad5eff725 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