Revision
635
Author
wsiegrist@apple.com
Date
2009-11-11 10:25:38 -0800 (Wed, 11 Nov 2009)

Log Message

Always use copyfile to backup files so there is no chance of the host system needing a file we temporarily moved out of the way.

Modified Paths

Diff

Modified: branches/PR-7250612/darwinup/Depot.cpp (634 => 635)


--- branches/PR-7250612/darwinup/Depot.cpp	2009-11-11 18:13:31 UTC (rev 634)
+++ branches/PR-7250612/darwinup/Depot.cpp	2009-11-11 18:25:38 UTC (rev 635)
@@ -467,36 +467,9 @@
 		++context->files_modified;
 
 		// XXX: res = file->backup()
+		IF_DEBUG("[backup] copyfile(%s, %s)\n", path, dstpath);
+		res = copyfile(path, dstpath, NULL, COPYFILE_ALL);
 
-		// copy files used by gnutar and libarchive instead of moving them
-		//  since we use tar during the archive process
-		size_t i = 0;
-		bool docopy = false;
-		const char* tarfiles[] = {"/usr/bin/tar",
-					  "/usr/bin/gnutar",
-					  "/usr/bin/bsdtar",
-					  "/usr/lib/dyld",
-					  "/usr/lib/libarchive",
-					  "/usr/lib/libbz2",
-					  "/usr/lib/libz",
-					  "/usr/lib/libSystem",
-					  "/usr/lib/libiconv",
-					  "/usr/lib/libgcc_s"};
-		size_t numfiles = sizeof(tarfiles)/sizeof(*tarfiles);
-		for (i = 0; i < numfiles; i++) {
-		        if (strncmp(tarfiles[i], relpath, strlen(tarfiles[i])) == 0) {
-			        docopy = true;
-				break;
-			}
-		}
-		if (docopy) {
-		        IF_DEBUG("[backup] copyfile(%s, %s)\n", path, dstpath);
-			res = copyfile(path, dstpath, NULL, COPYFILE_ALL);
-		} else {
-		        IF_DEBUG("[backup] rename(%s, %s)\n", path, dstpath);
-			res = rename(path, dstpath);
-		}
-
 		if (res != 0) fprintf(stderr, "%s:%d: backup failed: %s: %s (%d)\n", __FILE__, __LINE__, dstpath, strerror(errno), errno);
 		free(path);
 		free(dstpath);