1.0.47.1: fix longstanding bug in os_get_runtime_executable_path on darwin
authorCyrus Harmon <ch-sbcl@bobobeach.com>
Mon, 28 Mar 2011 02:42:09 +0000 (02:42 +0000)
committerCyrus Harmon <ch-sbcl@bobobeach.com>
Mon, 28 Mar 2011 02:42:09 +0000 (02:42 +0000)
 * in os_get_runtime_executable_path, we were wrongly assuming that
   size would be set to the actual size of the string on a successful
   call to NSGetExecutablePath. This isn't the case and we were
   setting path[1025] = '\0'; causing things to break with XCode 4's
   CLANG compiler.

 * While we're at it, we should check to make that runtime_path is not
   NULL before we free it, as there is a code path where we might end
   up trying to free runtime_path when it was NULL but
   saved_runtime_path was non-NULL.

src/runtime/darwin-os.c
src/runtime/runtime.c
version.lisp-expr

index 2d79d06..5e6642f 100644 (file)
@@ -36,8 +36,6 @@ os_get_runtime_executable_path(int external)
 
     if (_NSGetExecutablePath(path, &size) == -1)
         return NULL;
-    else
-        path[size] = '\0';
 
     return copied_string(path);
 }
index 0f1f0ff..d03cd8d 100644 (file)
@@ -337,7 +337,8 @@ main(int argc, char *argv[], char *envp[])
             core = (runtime_path ? runtime_path :
                     copied_string(saved_runtime_path));
         } else {
-            free(runtime_path);
+            if (runtime_path)
+                free(runtime_path);
         }
     }
 
index 5ba6139..023b4c8 100644 (file)
@@ -20,4 +20,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.47"
+"1.0.47.1"