diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2013-10-28 21:16:53 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2013-10-28 21:17:47 -0700 |
commit | 986382a0bb326167392635d6e883f3b76c7d8361 (patch) | |
tree | e807db09c13591a0358999c1d5054c61eece4568 | |
parent | edfd8bcc3490499d6f87f271a1da5dd17f169b59 (diff) | |
download | paxutils-986382a0bb326167392635d6e883f3b76c7d8361.tar.gz |
paxutils: support --sparse with tiny files on Netapp filers
* lib/system.h (ST_IS_SPARSE): Port to NFS + Netapp filers,
where a tiny file can have zero blocks but nonzero size.
Problem reported by Andrew J. Schorr in
<http://lists.gnu.org/archive/html/bug-tar/2013-10/msg00030.html>.
-rw-r--r-- | lib/system.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/system.h b/lib/system.h index ef46267..e7f531c 100644 --- a/lib/system.h +++ b/lib/system.h @@ -389,9 +389,16 @@ extern int errno; # define ST_NBLOCKSIZE 512 #endif +/* Network Appliance file systems store small files directly in the + inode if st_size <= 64; in this case the number of blocks can be + zero. Perhaps other file systems have similar problems; so, + somewhat arbitrarily, do not consider a file to be sparse if + it has no blocks but st_size < ST_NBLOCKSIZE. */ #define ST_IS_SPARSE(st) \ (ST_NBLOCKS (st) \ - < ((st).st_size / ST_NBLOCKSIZE + ((st).st_size % ST_NBLOCKSIZE != 0))) + < ((st).st_size / ST_NBLOCKSIZE \ + + ((st).st_size % ST_NBLOCKSIZE != 0 \ + && (st).st_size / ST_NBLOCKSIZE != 0))) /* Declare standard functions. */ |