Hi Janne,
On 01/11/2012 08:37 AM, Janne Blomqvist wrote:
Index: runtime/main.c =================================================================== --- runtime/main.c (revision 183089) +++ runtime/main.c (working copy) @@ -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
I had preferred a patch like the following. Tobias --- a/libgfortran/runtime/main.c +++ b/libgfortran/runtime/main.c @@ -117,9 +117,16 @@ store_exe_path (const char * argv0) #ifdef HAVE_GETCWD cwd = getcwd (buf, sizeof (buf)); #else - cwd = ""; + cwd = NULL; #endif + if (cwd == NULL) + { + exe_path = argv0; + please_free_exe_path_when_done = 0; + return; + } + /* exe_path will be cwd + "/" + argv[0] + "\0". This will not work if the executable is not in the cwd, but at this point we're out of better ideas. */