[darwinbuild-changes] [694] branches/PR-7529688/darwinup/Depot.cpp

source_changes at macosforge.org source_changes at macosforge.org
Fri Feb 5 13:09:46 PST 2010


Revision: 694
          http://trac.macosforge.org/projects/darwinbuild/changeset/694
Author:   wsiegrist at apple.com
Date:     2010-02-05 13:09:45 -0800 (Fri, 05 Feb 2010)
Log Message:
-----------
Use COPYFILE_NOFOLLOW since we want to copy the symlink itself into the backing store, not what it points to. Fixes bug where backups (and thus installs) fail when the destination filesystem contains a broken symlink. Also remove unnecessary null checks from free() calls.

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

Modified: branches/PR-7529688/darwinup/Depot.cpp
===================================================================
--- branches/PR-7529688/darwinup/Depot.cpp	2010-02-05 21:07:36 UTC (rev 693)
+++ branches/PR-7529688/darwinup/Depot.cpp	2010-02-05 21:09:45 UTC (rev 694)
@@ -656,7 +656,7 @@
 
 		// XXX: res = file->backup()
 		IF_DEBUG("[backup] copyfile(%s, %s)\n", path, dstpath);
-		res = copyfile(path, dstpath, NULL, COPYFILE_ALL);
+		res = copyfile(path, dstpath, NULL, COPYFILE_ALL|COPYFILE_NOFOLLOW);
 
 		if (res != 0) fprintf(stderr, "%s:%d: backup failed: %s: %s (%d)\n", __FILE__, __LINE__, dstpath, strerror(errno), errno);
 		free(path);
@@ -733,7 +733,7 @@
 	if (res == 0 && rollback_files == 0) {
 		res = this->remove(rollback);
 	}
-	
+
 	// Commit the archive and its list of files to the database.
 	// Note that the archive's "active" flag is still not set.
 	if (res == 0) {
@@ -770,8 +770,9 @@
 	// Remove the stage and rollback directories (save disk space)
 	remove_directory(archive_path);
 	remove_directory(rollback_path);
-	if (rollback_path) free(rollback_path);
-	if (archive_path) free(archive_path);
+
+	free(rollback_path);
+	free(archive_path);
 	
 	(void)this->lock(LOCK_SH);
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20100205/f03622a1/attachment.html>


More information about the darwinbuild-changes mailing list