Skip to content

Commit

Permalink
use statvfs() instead of non-std statfs()
Browse files Browse the repository at this point in the history
  • Loading branch information
stsp committed Aug 5, 2024
1 parent 878dda7 commit 7bcc4af
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <sys/stat.h>
#include <sys/vfs.h>
#include <sys/statvfs.h>
#include <stubinfo.h>
#include <process.h>
#include <sys/segments.h>
Expand Down Expand Up @@ -2493,7 +2493,7 @@ static void perform_dir(const char *arg)
int use_pause = 0;
unsigned long long avail; //was double avail; --Salvo
finddata_t ff;
struct statfs sf;
struct statvfs sf;
int rc;
unsigned int attrib = FA_DIREC+FA_RDONLY+FA_ARCH+FA_SYSTEM+FA_HIDDEN, first;
unsigned long filecount = 0, dircount = 0, bytecount = 0;
Expand Down Expand Up @@ -2639,7 +2639,7 @@ static void perform_dir(const char *arg)
printf("%10lu file(s) %14lu bytes\n", filecount, bytecount);
printf("%10lu dir(s) ", dircount);

rc = statfs(full_filespec, &sf);
rc = statvfs(full_filespec, &sf);
if (rc == 0) {
avail = (unsigned long long)sf.f_bavail * sf.f_bsize;
if (avail < 1048576)
Expand All @@ -2651,7 +2651,7 @@ static void perform_dir(const char *arg)
else
printf("%15.1f GB free\n", avail / 1024.0 / 1024.0 / 1024.0);
} else {
printf("statfs() failed\n");
printf("statvfs() failed\n");
}
}

Expand Down

0 comments on commit 7bcc4af

Please sign in to comment.