[darwinbuild-changes] [772] branches/PR-7593824/darwinup

source_changes at macosforge.org source_changes at macosforge.org
Fri Mar 12 09:31:06 PST 2010


Revision: 772
          http://trac.macosforge.org/projects/darwinbuild/changeset/772
Author:   wsiegrist at apple.com
Date:     2010-03-12 09:31:03 -0800 (Fri, 12 Mar 2010)
Log Message:
-----------
Gracefully handle being unable to determine os build

Modified Paths:
--------------
    branches/PR-7593824/darwinup/Depot.cpp
    branches/PR-7593824/darwinup/Utils.cpp

Modified: branches/PR-7593824/darwinup/Depot.cpp
===================================================================
--- branches/PR-7593824/darwinup/Depot.cpp	2010-03-12 17:07:04 UTC (rev 771)
+++ branches/PR-7593824/darwinup/Depot.cpp	2010-03-12 17:31:03 UTC (rev 772)
@@ -154,7 +154,6 @@
 		if (res) return res;
 		m_is_locked = 1;
 		res = build_number_for_path(&m_build, m_prefix);
-		if (res) return res;
 	}
 
 	struct stat sb;

Modified: branches/PR-7593824/darwinup/Utils.cpp
===================================================================
--- branches/PR-7593824/darwinup/Utils.cpp	2010-03-12 17:07:04 UTC (rev 771)
+++ branches/PR-7593824/darwinup/Utils.cpp	2010-03-12 17:31:03 UTC (rev 772)
@@ -336,12 +336,21 @@
 	char system[PATH_MAX];
 	char* base;
 	
+	*build = (char*)calloc(1, 16);
+	
 	// find the version plist for our target path
 	find_base_system_path(&base, path);
 	if (!base) return 1;	
 	snprintf(system, PATH_MAX, "%s/System/Library/CoreServices/SystemVersion.plist", base);
 	free(base);
 
+	struct stat sb;
+	res = stat(system, &sb);
+	if (res) {
+		snprintf(*build, 16, " ");
+		return 1;
+	}
+
 	// read version plist to get build number
 	const char* args[] = {
 		"/usr/libexec/PlistBuddy",
@@ -359,7 +368,6 @@
 	
 	// read from the pipe
 	close(pfd[1]);
-	*build = (char*)calloc(1, 16);
 	res = 1;
 	while (res > 0 && res < 15) {
 		res = read(pfd[0], *build, 15);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20100312/261523ea/attachment-0001.html>


More information about the darwinbuild-changes mailing list