diff mbox

[libfortran] PR 51803 getcwd() failure

Message ID CAO9iq9FSo3MORqtgET4bE8PZ6qyEkdvMFGvNoKnRL6cYhFHmMQ@mail.gmail.com
State New
Headers show

Commit Message

Janne Blomqvist Jan. 11, 2012, 7:37 a.m. UTC
Hi,

I committed the attached patch as obvious to trunk after the RM
considered it OK in the PR.
diff mbox

Patch

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

   /* exe_path will be cwd + "/" + argv[0] + "\0".  This will not work
Index: ChangeLog
===================================================================
--- ChangeLog   (revision 183089)
+++ ChangeLog   (working copy)
@@ -1,3 +1,9 @@ 
+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.
+
 2012-01-10  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51197