X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fcreate.c;h=eb528be25626e9db921a1012ed5608821888a51a;hb=711064182107ecdbc43965752fcaf88490711684;hp=4f623ac1bb0b4e6ad77aaa4a0c3e369f20b88283;hpb=29fb7356dfd1b88dcb4977c67b418004b11b6533;p=chaz%2Ftar diff --git a/src/create.c b/src/create.c index 4f623ac..eb528be 100644 --- a/src/create.c +++ b/src/create.c @@ -128,7 +128,7 @@ to_chars_subst (int negative, int gnu_format, uintmax_t value, size_t valsize, char const *minval_string; char const *maxval_string = STRINGIFY_BIGINT (maxval, maxbuf); char const *value_string; - + if (gnu_format) { uintmax_t m = maxval + 1 ? maxval + 1 : maxval / 2 + 1; @@ -138,7 +138,7 @@ to_chars_subst (int negative, int gnu_format, uintmax_t value, size_t valsize, } else minval_string = "0"; - + if (negative) { char *p = STRINGIFY_BIGINT (- value, valbuf + 1); @@ -147,7 +147,7 @@ to_chars_subst (int negative, int gnu_format, uintmax_t value, size_t valsize, } else value_string = STRINGIFY_BIGINT (value, valbuf); - + if (substitute) { int negsub; @@ -236,7 +236,7 @@ to_chars (int negative, uintmax_t value, size_t valsize, } else substitute = NULL; /* No substitution for formats, other than GNU */ - + return to_chars_subst (negative, gnu_format, value, valsize, substitute, where, size, type); } @@ -380,7 +380,7 @@ bool file_dumpable_p (struct tar_stat_info *st) { if (dev_null_output) - return totals_option && sparse_option && sparse_file_p (st); + return totals_option && sparse_option && ST_IS_SPARSE (st->stat); return !(st->archive_file_size == 0 && (st->stat.st_mode & MODE_R) == MODE_R); } @@ -663,7 +663,8 @@ start_header (struct tar_stat_info *st) if (mode_option) st->stat.st_mode = ((st->stat.st_mode & ~MODE_ALL) - | mode_adjust (st->stat.st_mode, mode_option, initial_umask)); + | mode_adjust (st->stat.st_mode, S_ISDIR (st->stat.st_mode) != 0, + initial_umask, mode_option, NULL)); /* Paul Eggert tried the trivial test ($WRITER cf a b; $READER tvf a) for a few tars and came up with the following interoperability @@ -730,7 +731,7 @@ start_header (struct tar_stat_info *st) } { - struct timespec mtime = st->mtime; + struct timespec mtime = set_mtime_option ? mtime_option : st->mtime; if (archive_format == POSIX_FORMAT) { if (MAX_OCTAL_VAL (header->header.mtime) < mtime.tv_sec @@ -1499,7 +1500,7 @@ dump_file0 (struct tar_stat_info *st, const char *p, { enum dump_status status; - if (fd != -1 && sparse_option && sparse_file_p (st)) + if (fd != -1 && sparse_option && ST_IS_SPARSE (st->stat)) { status = sparse_dump_file (fd, st); if (status == dump_status_not_implemented) @@ -1523,7 +1524,7 @@ dump_file0 (struct tar_stat_info *st, const char *p, } file_count_links (st); - + ok = status == dump_status_ok; }