[darwinbuild-changes] [791] branches/PR-7765119/darwinup/Depot.cpp

source_changes at macosforge.org source_changes at macosforge.org
Thu Mar 18 09:16:57 PDT 2010


Revision: 791
          http://trac.macosforge.org/projects/darwinbuild/changeset/791
Author:   wsiegrist at apple.com
Date:     2010-03-18 09:16:56 -0700 (Thu, 18 Mar 2010)
Log Message:
-----------
Do not try to take the lock until we create the storage we lock. Check for null context when iterating files (fixes crash in verify).

Modified Paths:
--------------
    branches/PR-7765119/darwinup/Depot.cpp

Modified: branches/PR-7765119/darwinup/Depot.cpp
===================================================================
--- branches/PR-7765119/darwinup/Depot.cpp	2010-03-18 16:15:07 UTC (rev 790)
+++ branches/PR-7765119/darwinup/Depot.cpp	2010-03-18 16:16:56 UTC (rev 791)
@@ -154,11 +154,6 @@
 				
 		build_number_for_path(&m_build, m_prefix);
 	}
-
-	// take an exclusive lock
-	res = this->lock(LOCK_EX);
-	if (res) return res;
-	m_is_locked = 1;			
 	
 	struct stat sb;
 	res = stat(m_database_path, &sb);
@@ -171,6 +166,11 @@
 		return -3;
 	}
 
+	// take an exclusive lock
+	res = this->lock(LOCK_EX);
+	if (res) return res;
+	m_is_locked = 1;			
+		
 	res = this->connect();
 
 	return res;
@@ -369,7 +369,8 @@
 	int res = DB_OK;
 	uint8_t** filelist;
 	uint32_t count;
-	bool reverse = ((InstallContext*)context)->reverse_files;
+	bool reverse = false;
+	if (context) reverse = ((InstallContext*)context)->reverse_files;
 	res = this->m_db->get_files(&filelist, &count, archive, reverse);
 	if (FOUND(res)) {
 		for (uint32_t i=0; i < count; i++) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20100318/547b8c13/attachment-0001.html>


More information about the darwinbuild-changes mailing list