X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fextract.c;h=55f3eb860e2a616f982529f667adb044b7caf16c;hb=03858cf583ce299b836d8a848967ce290a6bf303;hp=ecbde1a8c939a637d35e7addba297f7fbaac8951;hpb=189e4364741e927216a254b8a51d96af2d954df8;p=chaz%2Ftar diff --git a/src/extract.c b/src/extract.c index ecbde1a..55f3eb8 100644 --- a/src/extract.c +++ b/src/extract.c @@ -271,15 +271,6 @@ set_mode (char const *file_name, } } -/* Return true if A and B are the same birthtimes. - Unavailable birthtimes, which have negative tv_nsec members, - all compare equal to each other. */ -static bool -same_birthtime (struct timespec a, struct timespec b) -{ - return (a.tv_nsec == b.tv_nsec && (a.tv_nsec < 0 || a.tv_sec == b.tv_sec)); -} - /* Check time after successfully setting FILE_NAME's time stamp to T. */ static void check_time (char const *file_name, struct timespec t) @@ -651,9 +642,14 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made) switch (old_files_option) { - case KEEP_OLD_FILES: + case SKIP_OLD_FILES: + WARNOPT (WARN_EXISTING_FILE, + (0, 0, _("%s: skipping existing file"), file_name)); return RECOVER_SKIP; + case KEEP_OLD_FILES: + return RECOVER_NO; + case KEEP_NEWER_FILES: if (file_newer_p (file_name, stp, ¤t_stat_info)) break; @@ -1002,7 +998,7 @@ extract_file (char *file_name, int typeflag) if (written > size) written = size; errno = 0; - count = full_write (fd, data_block->buffer, written); + count = blocking_write (fd, data_block->buffer, written); size -= written; set_next_block_after ((union block *) @@ -1146,7 +1142,8 @@ extract_link (char *file_name, int typeflag) if (ds->change_dir == chdir_current && ds->dev == st1.st_dev && ds->ino == st1.st_ino - && same_birthtime (ds->birthtime, get_stat_birthtime (&st1))) + && (timespec_cmp (ds->birthtime, get_stat_birthtime (&st1)) + == 0)) { struct string_list *p = xmalloc (offsetof (struct string_list, string) + strlen (file_name) + 1); @@ -1512,7 +1509,7 @@ apply_delayed_links (void) if (fstatat (chdir_fd, source, &st, AT_SYMLINK_NOFOLLOW) == 0 && st.st_dev == ds->dev && st.st_ino == ds->ino - && same_birthtime (get_stat_birthtime (&st), ds->birthtime)) + && timespec_cmp (get_stat_birthtime (&st), ds->birthtime) == 0) { /* Unlink the placeholder, then create a hard link if possible, a symbolic link otherwise. */