svn commit: trunk/busybox/archival

vda at busybox.net vda at busybox.net
Sun Feb 17 14:29:26 UTC 2008


Author: vda
Date: 2008-02-17 06:29:25 -0800 (Sun, 17 Feb 2008)
New Revision: 21045

Log:
dpkg: fix bug where existence check was reversed



Modified:
   trunk/busybox/archival/dpkg.c


Changeset:
Modified: trunk/busybox/archival/dpkg.c
===================================================================
--- trunk/busybox/archival/dpkg.c	2008-02-17 14:28:53 UTC (rev 21044)
+++ trunk/busybox/archival/dpkg.c	2008-02-17 14:29:25 UTC (rev 21045)
@@ -913,20 +913,16 @@
 	fclose(old_status_file);
 	fclose(new_status_file);
 
-
 	/* Create a separate backfile to dpkg */
 	if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) {
-		struct stat stat_buf;
-		xstat("/var/lib/dpkg/status", &stat_buf);
+		if (errno != ENOENT)
+			bb_error_msg_and_die("cannot create backup status file");
 		/* Its ok if renaming the status file fails because status
 		 * file doesnt exist, maybe we are starting from scratch */
 		bb_error_msg("no status file found, creating new one");
 	}
 
-	if (rename("/var/lib/dpkg/status.udeb", "/var/lib/dpkg/status") == -1) {
-		bb_error_msg_and_die("DANGER: cannot create status file, "
-			"you need to manually repair your status file");
-	}
+	xrename("/var/lib/dpkg/status.udeb", "/var/lib/dpkg/status");
 }
 
 /* This function returns TRUE if the given package can satisfy a
@@ -1344,7 +1340,7 @@
 	free_array(exclude_files);
 
 	/* rename <package>.conffile to <package>.list */
-	rename(conffile_name, list_name);
+	xrename(conffile_name, list_name);
 
 	/* Change package status */
 	set_status(status_num, "config-files", 3);




More information about the busybox-cvs mailing list