From 87633176610f86df377de7362ebb081394815733 Mon Sep 17 00:00:00 2001 From: Janne Blomqvist Date: Wed, 11 Jan 2012 09:34:16 +0200 Subject: [PATCH] PR 51803 Handle getcwd failure and lack of the function better. 2012-01-11 Janne Blomqvist Mike Stump PR libfortran/51803 * runtime/main.c (store_exe_path): Handle getcwd failure and lack of the function better. Co-Authored-By: Mike Stump From-SVN: r183090 --- libgfortran/ChangeLog | 6 ++++++ libgfortran/runtime/main.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index e82d44282d2..3e27ed952c0 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2012-01-11 Janne Blomqvist + Mike Stump + PR libfortran/51803 + * runtime/main.c (store_exe_path): Handle getcwd failure and lack + of the function better. + 2012-01-10 Tobias Burnus PR fortran/51197 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