#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || (__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
#include <sys/param.h>
#include <sys/mount.h>
+#elif defined(__NetBSD__)
#else
#include <mntent.h>
#endif
if (statfs(path, &buf) == -1)
return;
+#elif defined(__NetBSD__)
+ struct statvfs buf;
+
+ if (statvfs(path, &buf) == -1)
+ return;
#else
struct statvfs buf;
+ if (format_not_mounted == NULL) {
+ format_not_mounted = "";
+ }
+
if (statvfs(path, &buf) == -1) {
/* If statvfs errors, e.g., due to the path not existing,
* we use the format for a not mounted device. */
- if (format_not_mounted != NULL) {
- format = format_not_mounted;
- }
- } else if (format_not_mounted != NULL) {
+ format = format_not_mounted;
+ } else {
FILE *mntentfile = setmntent("/etc/mtab", "r");
struct mntent *m;
bool found = false;