tar/tar-1.15.1-sparseTotals.patch

37 lines
1.0 KiB
Diff
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--- tar-1.15.1/src/create.c.sparseTotals 2005-07-27 11:10:38.000000000 +0200
+++ tar-1.15.1/src/create.c 2005-07-27 11:10:50.000000000 +0200
@@ -332,16 +332,20 @@
}
-/* A file is not dumpable if
+/* A file is considered dumpable if it is sparse and both --sparse and --totals
+ are specified.
+ Otherwise, it is dumpable unless any of the following conditions occur:
+
a) it is empty *and* world-readable, or
b) current archive is /dev/null */
bool
file_dumpable_p (struct tar_stat_info *st)
{
- return !(dev_null_output
- || (st->archive_file_size == 0
- && (st->stat.st_mode & MODE_R) == MODE_R));
+ if (dev_null_output)
+ return totals_option && sparse_option && sparse_file_p (st);
+ return !(st->archive_file_size == 0
+ && (st->stat.st_mode & MODE_R) == MODE_R);
}
@@ -1437,7 +1441,7 @@
else
fd = -1;
- if (sparse_option && sparse_file_p (st))
+ if (fd != -1 && sparse_option && sparse_file_p (st))
{
status = sparse_dump_file (fd, st);
if (status == dump_status_not_implemented)