X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fcreate.c;h=6916f6715e2d4f525ce0b497d0284ec9b7fae6d3;hb=196caec187f27a3c3e4a68eee6bb388d79dac960;hp=de09f9f558c13c93fc6da394048c8e959a6eb5da;hpb=3f3860fd6ae8f77346280cf707ef2f9c57f414ea;p=chaz%2Ftar diff --git a/src/create.c b/src/create.c index de09f9f..6916f67 100644 --- a/src/create.c +++ b/src/create.c @@ -152,7 +152,7 @@ to_chars (int negative, uintmax_t value, size_t valsize, if (! warned_once) { warned_once = 1; - WARN ((0, 0, _("Generating negative octal headers\n"))); + WARN ((0, 0, _("Generating negative octal headers"))); } where[size - 1] = '\0'; to_octal (value & MAX_VAL_WITH_DIGITS (valsize * CHAR_BIT, 1), @@ -567,8 +567,6 @@ finish_header (union block *header) uintmax_to_chars ((uintmax_t) sum, header->header.chksum, 7); - set_next_block_after (header); - if (verbose_option && header->header.typeflag != GNUTYPE_LONGLINK && header->header.typeflag != GNUTYPE_LONGNAME) @@ -580,6 +578,8 @@ finish_header (union block *header) current_format = archive_format; print_header (); } + + set_next_block_after (header); } /* Sparse file processing. */ @@ -924,7 +924,7 @@ create_archive (void) /* Dump a single file, recursing on directories. P is the file name to dump. TOP_LEVEL tells whether this is a top-level call; zero means no, positive means yes, and negative means an incremental - dump where it's irrelevant. PARENT_DEVICE is the device of P's + dump. PARENT_DEVICE is the device of P's parent directory; it is examined only if TOP_LEVEL is zero. Set global CURRENT_STAT to stat output for this file. */ @@ -939,8 +939,8 @@ dump_file (char *p, int top_level, dev_t parent_device) char type; union block *exhdr; char save_typeflag; + time_t original_ctime; struct utimbuf restore_times; - off_t restore_size; /* FIXME: `header' and `upperbound' might be used uninitialized in this function. Reported by Bruno Haible. */ @@ -956,9 +956,9 @@ dump_file (char *p, int top_level, dev_t parent_device) return; } + original_ctime = current_stat.st_ctime; restore_times.actime = current_stat.st_atime; restore_times.modtime = current_stat.st_mtime; - restore_size = current_stat.st_size; #ifdef S_ISHIDDEN if (S_ISHIDDEN (current_stat.st_mode)) @@ -1140,7 +1140,7 @@ dump_file (char *p, int top_level, dev_t parent_device) /* Now output all the files in the directory. */ - errno = 0; /* FIXME: errno should be read-only */ + errno = 0; directory = opendir (p); if (!directory) @@ -1363,7 +1363,10 @@ dump_file (char *p, int top_level, dev_t parent_device) f = open (p, O_RDONLY | O_BINARY); if (f < 0) { - WARN ((0, errno, _("Cannot add file %s"), p)); + if (! top_level && errno == ENOENT) + WARN ((0, 0, _("%s: file removed before we read it"), p)); + else + WARN ((0, errno, _("Cannot add file %s"), p)); if (!ignore_failed_read_option) exit_status = TAREXIT_FAILURE; return; @@ -1478,9 +1481,8 @@ dump_file (char *p, int top_level, dev_t parent_device) struct stat final_stat; if (fstat (f, &final_stat) != 0) ERROR ((0, errno, "%s: fstat", p)); - else if (final_stat.st_mtime != restore_times.modtime - || final_stat.st_size != restore_size) - ERROR ((0, errno, _("%s: file changed as we read it"), p)); + else if (final_stat.st_ctime != original_ctime) + ERROR ((0, 0, _("%s: file changed as we read it"), p)); if (close (f) != 0) ERROR ((0, errno, _("%s: close"), p)); if (atime_preserve_option) @@ -1555,6 +1557,13 @@ dump_file (char *p, int top_level, dev_t parent_device) else if (S_ISFIFO (current_stat.st_mode) || S_ISSOCK (current_stat.st_mode)) type = FIFOTYPE; +#ifdef S_ISDOOR + else if (S_ISDOOR (current_stat.st_mode)) + { + WARN ((0, 0, _("%s: door ignored"), p)); + return; + } +#endif else goto unknown; }