[openssh-commits] [openssh] 05/06: Make sure we have struct statfs before using.

git+noreply at mindrot.org git+noreply at mindrot.org
Mon Oct 28 19:03:02 AEDT 2019


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit d561b0b2fa2531b4cc3bc70a7d657c6485c9fd0b
Author: Darren Tucker <dtucker at dtucker.net>
Date:   Mon Oct 28 16:09:04 2019 +1100

    Make sure we have struct statfs before using.
---
 configure.ac                 |  2 +-
 openbsd-compat/bsd-statvfs.c | 10 ++++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 268fe1a4..ea99887f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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>
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));

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list