Skip to content

Commit 66deb43

Browse files

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/detection/disk/disk_bsd.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#ifdef __NetBSD__
99
#include <sys/types.h>
1010
#include <sys/statvfs.h>
11-
#define getfsstat(...) getvfsstat(__VA_ARGS__)
1211
#define statfs statvfs
1312
#define f_flags f_flag
1413
#define f_bsize f_frsize
@@ -125,14 +124,22 @@ static void detectFsInfo(struct statfs* fs, FFDisk* disk)
125124

126125
const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
127126
{
127+
#ifndef __NetBSD__
128128
int size = getfsstat(NULL, 0, MNT_WAIT);
129-
130-
if(size <= 0)
131-
return "getfsstat(NULL, 0, MNT_WAIT) failed";
129+
if(size <= 0) return "getfsstat(NULL, 0, MNT_WAIT) failed";
130+
#else
131+
int size = getvfsstat(NULL, 0, ST_WAIT);
132+
if(size <= 0) return "getvfsstat(NULL, 0, ST_WAIT) failed";
133+
#endif
132134

133135
FF_AUTO_FREE struct statfs* buf = malloc(sizeof(*buf) * (unsigned) size);
136+
#ifndef __NetBSD__
134137
if(getfsstat(buf, (int) (sizeof(*buf) * (unsigned) size), MNT_NOWAIT) <= 0)
135138
return "getfsstat(buf, size, MNT_NOWAIT) failed";
139+
#else
140+
if(getvfsstat(buf, sizeof(*buf) * (unsigned) size, ST_NOWAIT) <= 0)
141+
return "getvfsstat(buf, size, ST_NOWAIT) failed";
142+
#endif
136143

137144
for(struct statfs* fs = buf; fs < buf + size; ++fs)
138145
{

0 commit comments

Comments
 (0)