diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-17 14:29:25 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-17 14:29:25 +0000 |
commit | b3b0753593abaf307c961bd45f5e2385a852a076 (patch) | |
tree | 6551a1f3cf22380e3c89841aaa6c647d4ebb8bc1 | |
parent | cb448fe01bbe75ef31c3190e8b63b0e1a320ffb4 (diff) | |
download | busybox-w32-b3b0753593abaf307c961bd45f5e2385a852a076.tar.gz busybox-w32-b3b0753593abaf307c961bd45f5e2385a852a076.tar.bz2 busybox-w32-b3b0753593abaf307c961bd45f5e2385a852a076.zip |
dpkg: fix bug where existence check was reversed
-rw-r--r-- | archival/dpkg.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c index 1db53f494..e90e82b64 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c | |||
@@ -913,20 +913,16 @@ static void write_status_file(deb_file_t **deb_file) | |||
913 | fclose(old_status_file); | 913 | fclose(old_status_file); |
914 | fclose(new_status_file); | 914 | fclose(new_status_file); |
915 | 915 | ||
916 | |||
917 | /* Create a separate backfile to dpkg */ | 916 | /* Create a separate backfile to dpkg */ |
918 | if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) { | 917 | if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) { |
919 | struct stat stat_buf; | 918 | if (errno != ENOENT) |
920 | xstat("/var/lib/dpkg/status", &stat_buf); | 919 | bb_error_msg_and_die("cannot create backup status file"); |
921 | /* Its ok if renaming the status file fails because status | 920 | /* Its ok if renaming the status file fails because status |
922 | * file doesnt exist, maybe we are starting from scratch */ | 921 | * file doesnt exist, maybe we are starting from scratch */ |
923 | bb_error_msg("no status file found, creating new one"); | 922 | bb_error_msg("no status file found, creating new one"); |
924 | } | 923 | } |
925 | 924 | ||
926 | if (rename("/var/lib/dpkg/status.udeb", "/var/lib/dpkg/status") == -1) { | 925 | xrename("/var/lib/dpkg/status.udeb", "/var/lib/dpkg/status"); |
927 | bb_error_msg_and_die("DANGER: cannot create status file, " | ||
928 | "you need to manually repair your status file"); | ||
929 | } | ||
930 | } | 926 | } |
931 | 927 | ||
932 | /* This function returns TRUE if the given package can satisfy a | 928 | /* This function returns TRUE if the given package can satisfy a |
@@ -1344,7 +1340,7 @@ static void remove_package(const unsigned package_num, int noisy) | |||
1344 | free_array(exclude_files); | 1340 | free_array(exclude_files); |
1345 | 1341 | ||
1346 | /* rename <package>.conffile to <package>.list */ | 1342 | /* rename <package>.conffile to <package>.list */ |
1347 | rename(conffile_name, list_name); | 1343 | xrename(conffile_name, list_name); |
1348 | 1344 | ||
1349 | /* Change package status */ | 1345 | /* Change package status */ |
1350 | set_status(status_num, "config-files", 3); | 1346 | set_status(status_num, "config-files", 3); |