summaryrefslogtreecommitdiff
path: root/usr.sbin/makefs
diff options
context:
space:
mode:
authorjmc <jmc@NetBSD.org>2004-10-12 03:28:30 +0000
committerjmc <jmc@NetBSD.org>2004-10-12 03:28:30 +0000
commit7a47cf149bab3eb1ccff28bfc0bf0cb1a0ff5b29 (patch)
treee4357b05e63e5e321ee786471031e6911a1422e3 /usr.sbin/makefs
parent3f13770b97cd4a3757de649db890a80f1a473d34 (diff)
Check for fstatvfs and provide/use it only if the host system has it.
Fixes PR#27221
Diffstat (limited to 'usr.sbin/makefs')
-rw-r--r--usr.sbin/makefs/ffs.c12
-rw-r--r--usr.sbin/makefs/makefs.h3
2 files changed, 8 insertions, 7 deletions
diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c
index a4a24cb3ca8..07026d93fec 100644
--- a/usr.sbin/makefs/ffs.c
+++ b/usr.sbin/makefs/ffs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs.c,v 1.31 2004/07/24 16:30:50 dbj Exp $ */
+/* $NetBSD: ffs.c,v 1.32 2004/10/12 03:28:30 jmc Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -71,7 +71,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: ffs.c,v 1.31 2004/07/24 16:30:50 dbj Exp $");
+__RCSID("$NetBSD: ffs.c,v 1.32 2004/10/12 03:28:30 jmc Exp $");
#endif /* !__lint */
#include <sys/param.h>
@@ -91,7 +91,7 @@ __RCSID("$NetBSD: ffs.c,v 1.31 2004/07/24 16:30:50 dbj Exp $");
#include "makefs.h"
-#if HAVE_STRUCT_STATVFS_F_IOSIZE
+#if HAVE_STRUCT_STATVFS_F_IOSIZE && HAVE_FSTATVFS
#include <sys/statvfs.h>
#endif
@@ -426,7 +426,7 @@ ffs_dump_fsinfo(fsinfo_t *f)
static int
ffs_create_image(const char *image, fsinfo_t *fsopts)
{
-#if HAVE_STRUCT_STATVFS_F_IOSIZE
+#if HAVE_STRUCT_STATVFS_F_IOSIZE && HAVE_FSTATVFS
struct statvfs sfs;
#endif
struct fs *fs;
@@ -445,11 +445,11 @@ ffs_create_image(const char *image, fsinfo_t *fsopts)
}
/* zero image */
-#if HAVE_STRUCT_STATVFS_F_IOSIZE
+#if HAVE_STRUCT_STATVFS_F_IOSIZE && HAVE_FSTATVFS
if (fstatvfs(fsopts->fd, &sfs) == -1) {
#endif
bufsize = 8192;
-#if HAVE_STRUCT_STATVFS_F_IOSIZE
+#if HAVE_STRUCT_STATVFS_F_IOSIZE && HAVE_FSTATVFS
warn("can't fstatvfs `%s', using default %d byte chunk",
image, bufsize);
} else
diff --git a/usr.sbin/makefs/makefs.h b/usr.sbin/makefs/makefs.h
index ada563b1c5e..fbdf35dcc89 100644
--- a/usr.sbin/makefs/makefs.h
+++ b/usr.sbin/makefs/makefs.h
@@ -1,4 +1,4 @@
-/* $NetBSD: makefs.h,v 1.14 2004/06/20 22:20:18 jmc Exp $ */
+/* $NetBSD: makefs.h,v 1.15 2004/10/12 03:28:30 jmc Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -46,6 +46,7 @@
#define HAVE_STRUCT_STAT_ST_MTIMENSEC 1
#define HAVE_STRUCT_STATVFS_F_IOSIZE 1
#define HAVE_STRUCT_STAT_BIRTHTIME 1
+#define HAVE_FSTATVFS 1
#endif
#include <sys/stat.h>