diff --git a/SystemTools.cxx b/SystemTools.cxx
index 82c8dc9a11936c9d9af4436ffa3fc89789d22320..b3afa965e8911cd932db0362cc812b9d448bf72b 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -118,12 +118,14 @@ inline int Rmdir(const char* dir)
 }
 inline const char* Getcwd(char* buf, unsigned int len)
 {
-  const char* ret _getcwd(buf, len);
+  const char* ret = _getcwd(buf, len);
   if(!ret)
     {
     fprintf(stderr, "No current working directory.\n");
     abort();
     }
+
+  return ret;
 }
 inline int Chdir(const char* dir)
 {