summaryrefslogtreecommitdiff
path: root/openbsd-compat/bsd-statvfs.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2019-10-28 16:09:04 +1100
committerDarren Tucker <dtucker@dtucker.net>2019-10-28 16:27:53 +1100
commitd561b0b2fa2531b4cc3bc70a7d657c6485c9fd0b (patch)
treedd65310dd68efa3a4f6e1ddf613caa60adee5ab6 /openbsd-compat/bsd-statvfs.c
parent2912596aecfcf48e5115c7a906d1e664f7717a4b (diff)
downloadopenssh-git-d561b0b2fa2531b4cc3bc70a7d657c6485c9fd0b.tar.gz
Make sure we have struct statfs before using.
Diffstat (limited to 'openbsd-compat/bsd-statvfs.c')
-rw-r--r--openbsd-compat/bsd-statvfs.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/openbsd-compat/bsd-statvfs.c b/openbsd-compat/bsd-statvfs.c
index e3bd87d9..10d87643 100644
--- a/openbsd-compat/bsd-statvfs.c
+++ b/openbsd-compat/bsd-statvfs.c
@@ -29,6 +29,11 @@
# define MNAMELEN 32
#endif
+#ifdef HAVE_STRUCT_STATFS_F_FILES
+# define HAVE_STRUCT_STATFS
+#endif
+
+#ifdef HAVE_STRUCT_STATFS
static void
copy_statfs_to_statvfs(struct statvfs *to, struct statfs *from)
{
@@ -48,11 +53,12 @@ copy_statfs_to_statvfs(struct statvfs *to, struct statfs *from)
#endif
to->f_namemax = MNAMELEN;
}
+#endif
# ifndef HAVE_STATVFS
int statvfs(const char *path, struct statvfs *buf)
{
-# ifdef HAVE_STATFS
+# if defined(HAVE_STATFS) && defined(HAVE_STRUCT_STATFS)
struct statfs fs;
memset(&fs, 0, sizeof(fs));
@@ -70,7 +76,7 @@ int statvfs(const char *path, struct statvfs *buf)
# ifndef HAVE_FSTATVFS
int fstatvfs(int fd, struct statvfs *buf)
{
-# ifdef HAVE_FSTATFS
+# if defined(HAVE_FSTATFS) && defined(HAVE_STRUCT_STATFS)
struct statfs fs;
memset(&fs, 0, sizeof(fs));