]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
Make sure we have struct statfs before using.
authorDarren Tucker <dtucker@dtucker.net>
Mon, 28 Oct 2019 05:09:04 +0000 (16:09 +1100)
committerDarren Tucker <dtucker@dtucker.net>
Mon, 28 Oct 2019 05:27:53 +0000 (16:27 +1100)
configure.ac
openbsd-compat/bsd-statvfs.c

index 268fe1a4b9466396fb1a523a066613b9f375f2b2..ea99887fddb2842abda204c5ebb4d860104dfbcb 100644 (file)
@@ -3751,7 +3751,7 @@ AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
 #endif
 ])
 
-AC_CHECK_MEMBERS([struct statfs.f_flags], [], [], [[
+AC_CHECK_MEMBERS([struct statfs.f_files, struct statfs.f_flags], [], [], [[
 #include <sys/types.h>
 #ifdef HAVE_SYS_BITYPES_H
 #include <sys/bitypes.h>
index e3bd87d985a3063fde541f45634d01288b1ae749..10d8764392c247b28977e02c982f717c73641208 100644 (file)
 # 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));