libunarchive: fix reversed test for older/newer

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2009-11-24 01:16:12 +01:00
parent 8d580c72f4
commit 6ccaa23f2b

View File

@ -30,13 +30,13 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
} }
else if (archive_handle->ah_flags & ARCHIVE_EXTRACT_NEWER) { else if (archive_handle->ah_flags & ARCHIVE_EXTRACT_NEWER) {
/* Remove the existing entry if its older than the extracted entry */ /* Remove the existing entry if its older than the extracted entry */
struct stat statbuf; struct stat existing_sb;
if (lstat(file_header->name, &statbuf) == -1) { if (lstat(file_header->name, &existing_sb) == -1) {
if (errno != ENOENT) { if (errno != ENOENT) {
bb_perror_msg_and_die("can't stat old file"); bb_perror_msg_and_die("can't stat old file");
} }
} }
else if (statbuf.st_mtime <= file_header->mtime) { else if (existing_sb.st_mtime >= file_header->mtime) {
if (!(archive_handle->ah_flags & ARCHIVE_EXTRACT_QUIET)) { if (!(archive_handle->ah_flags & ARCHIVE_EXTRACT_QUIET)) {
bb_error_msg("%s not created: newer or " bb_error_msg("%s not created: newer or "
"same age file exists", file_header->name); "same age file exists", file_header->name);