From: Wayne Davison Date: Sat, 15 Oct 2016 18:13:28 +0000 (-0700) Subject: Use S_BLKSIZE when multiplying st_blocks. X-Git-Tag: v3.1.3pre1~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d1a1fec1340254926e17f5d83f848f7574286a33;p=thirdparty%2Frsync.git Use S_BLKSIZE when multiplying st_blocks. --- diff --git a/syscall.c b/syscall.c index fa53b638..d89eacd5 100644 --- a/syscall.c +++ b/syscall.c @@ -43,6 +43,16 @@ extern int preallocate_files; extern int preserve_perms; extern int preserve_executability; +#ifndef S_BLKSIZE +# if defined hpux || defined __hpux__ || defined __hpux +# define S_BLKSIZE 1024 +# elif defined _AIX && defined _I386 +# define S_BLKSIZE 4096 +# else +# define S_BLKSIZE 512 +# endif +#endif + #define RETURN_ERROR_IF(x,e) \ do { \ if (x) { \ @@ -456,7 +466,7 @@ OFF_T do_fallocate(int fd, OFF_T offset, OFF_T length) STRUCT_STAT st; if (do_fstat(fd, &st) < 0) return length; - return st.st_blocks * 512; + return st.st_blocks * S_BLKSIZE; } return 0; }