The problem is an integer overflow.
Declare the variables free_blk and blk_size as long and change the format of the last printf statement as follow:
Code:
#include <sys/statvfs.h>
#include <stdio.h>
int main(){
struct statvfs buffer;
int status;
long free_blk;
long blk_size;
status = statvfs("/", &buffer);
printf("free blocks: %u\n",buffer.f_bavail);
printf("block size: %u\n",buffer.f_bsize);
free_blk = buffer.f_bavail;
blk_size = buffer.f_bsize;
printf("total size: %Ld\n",free_blk*blk_size);
return 0;
}
Regards