X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=lib%2Fsystem.h;h=e7f531c8836eccbf9705866ca3a24220c9b636ac;hb=HEAD;hp=2deb585b41baf7b16b27d79cfe8f7a8b5912995e;hpb=138fc7e67e3d9845cd7d81aad0e9c7724784f9b9;p=debian%2Ftar diff --git a/lib/system.h b/lib/system.h index 2deb585b..e7f531c8 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. */ @@ -471,8 +478,11 @@ char *getenv (); # define SET_BINARY_MODE(arc) # define ERRNO_IS_EACCES 0 # define TTY_NAME "/dev/tty" -# define sys_reset_uid_gid() \ - do { setuid (getuid ()); setgid (getgid ()); } while (0) +# define sys_reset_uid_gid() \ + do { \ + if (! (setuid (getuid ()) == 0 && setgid (getgid ()) == 0)) \ + abort (); \ + } while (0) #endif #if XENIX