[openssh-commits] [openssh] 05/07: bsd-statvfs: include sys/vfs.h, check for f_flags.

git+noreply at mindrot.org git+noreply at mindrot.org
Mon Feb 26 00:15:47 AEDT 2018


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

dtucker pushed a commit to branch master
in repository openssh.

commit 11057564eb6ab8fd987de50c3d7f394c6f6632b7
Author: Darren Tucker <dtucker at dtucker.net>
Date:   Sun Feb 25 11:22:57 2018 +1100

    bsd-statvfs: include sys/vfs.h, check for f_flags.
---
 configure.ac                 | 18 ++++++++++++++++++
 openbsd-compat/bsd-statvfs.c |  8 ++++++++
 openbsd-compat/bsd-statvfs.h |  3 +++
 3 files changed, 29 insertions(+)

diff --git a/configure.ac b/configure.ac
index 605844ba..e9762ba6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -409,6 +409,7 @@ AC_CHECK_HEADERS([ \
 	sys/sysmacros.h \
 	sys/time.h \
 	sys/timers.h \
+	sys/vfs.h \
 	time.h \
 	tmpdir.h \
 	ttyent.h \
@@ -3659,6 +3660,23 @@ AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
 #endif
 ])
 
+AC_CHECK_MEMBERS([struct statfs.f_flags], [], [], [[
+#include <sys/types.h>
+#ifdef HAVE_SYS_BITYPES_H
+#include <sys/bitypes.h>
+#endif
+#ifdef HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+#ifdef HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+]])
+
+
 AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
 [#include <sys/types.h>
 #include <netinet/in.h>])
diff --git a/openbsd-compat/bsd-statvfs.c b/openbsd-compat/bsd-statvfs.c
index 458dbe89..e3bd87d9 100644
--- a/openbsd-compat/bsd-statvfs.c
+++ b/openbsd-compat/bsd-statvfs.c
@@ -25,6 +25,10 @@
 
 #include <errno.h>
 
+#ifndef MNAMELEN
+# define MNAMELEN 32
+#endif
+
 static void
 copy_statfs_to_statvfs(struct statvfs *to, struct statfs *from)
 {
@@ -37,7 +41,11 @@ copy_statfs_to_statvfs(struct statvfs *to, struct statfs *from)
 	to->f_ffree = from->f_ffree;
 	to->f_favail = from->f_ffree;	/* no exact equivalent */
 	to->f_fsid = 0;			/* XXX fix me */
+#ifdef HAVE_STRUCT_STATFS_F_FLAGS
 	to->f_flag = from->f_flags;
+#else
+	to->f_flag = 0;
+#endif
 	to->f_namemax = MNAMELEN;
 }
 
diff --git a/openbsd-compat/bsd-statvfs.h b/openbsd-compat/bsd-statvfs.h
index 815ec03b..e2a4c15f 100644
--- a/openbsd-compat/bsd-statvfs.h
+++ b/openbsd-compat/bsd-statvfs.h
@@ -26,6 +26,9 @@
 #ifdef HAVE_SYS_STATFS_H
 #include <sys/statfs.h>
 #endif
+#ifdef HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
 
 #ifndef HAVE_FSBLKCNT_T
 typedef unsigned long fsblkcnt_t;

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


More information about the openssh-commits mailing list