From: Frederic Marchal Date: Thu, 5 Mar 2015 14:35:03 +0000 (+0100) Subject: Get the file size with the available stat member X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=31990f844a481c777fab055ba86686744ca400f3;p=thirdparty%2Fsarg.git Get the file size with the available stat member On MinGW, the stat structure doesn't have all the member variables used to compute the size of a file. --- diff --git a/index.c b/index.c index 675d167..bed6f5b 100644 --- a/index.c +++ b/index.c @@ -107,6 +107,7 @@ void make_index(void) */ static long long int get_file_size(struct stat *statb) { +#ifdef __linux__ long long int blocks; //return(statb->st_size);//the size of the file content @@ -114,6 +115,9 @@ static long long int get_file_size(struct stat *statb) if (statb->st_blksize==0) return(statb->st_size); blocks=(statb->st_size+statb->st_blksize-1)/statb->st_blksize; return(blocks*statb->st_blksize);//how many bytes occupied on disk +#else + return(statb->st_size); +#endif } /*!