From: Janne Blomqvist Date: Wed, 11 Jan 2012 07:34:16 +0000 (+0200) Subject: PR 51803 Handle getcwd failure and lack of the function better. X-Git-Tag: releases/gcc-4.7.0~1056 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=87633176610f86df377de7362ebb081394815733;p=thirdparty%2Fgcc.git 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 --- diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index e82d44282d2a..3e27ed952c05 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 11b535afa924..1cad5eff7257 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