[openssh-commits] [openssh] 02/04: Provide compat shims for sys/{mount.h, statvfs.h).

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Feb 10 13:17:43 AEDT 2026


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

dtucker pushed a commit to branch master
in repository openssh.

commit 3e9c4ed3b0e5d3890fcd2cbc9c3b595f17ea1946
Author: Darren Tucker <dtucker at dtucker.net>
AuthorDate: Tue Feb 10 05:34:46 2026 +1100

    Provide compat shims for sys/{mount.h,statvfs.h).
    
    In addition to shimming on platforms that don't have them, we also need to
    shim sys/mount.h on DragonFlyBSD since it uses its native STAILQ_ENTRYs
    which our compat queues.h does not have, which causes sftp-server.o to
    not build.  This is a little icky, but it limits the blast radius to
    just one source file on only DragonFly.  ok djm@
---
 configure.ac  | 12 ++++++++++++
 sftp-client.c |  4 +---
 sftp-server.c |  4 ----
 sftp.c        |  4 +---
 4 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index c6245305d..42dffd154 100644
--- a/configure.ac
+++ b/configure.ac
@@ -536,7 +536,9 @@ AC_CHECK_HEADERS([ \
     poll.h \
     stdint.h \
     sys/mman.h \
+    sys/mount.h \
     sys/stat.h \
+    sys/statvfs.h \
     sys/time.h \
     sys/un.h \
     time.h \
@@ -569,6 +571,16 @@ for include in sys/queue.h sys/tree.h; do
 	esac >"$header"
 done
 
+# DragonFly uses STAILQ_* in its sys/mount.h, so we explicitly
+# need to include the system one first, not our shim.
+case "$host" in
+*-*-dragonfly*)
+	mkdir -p openbsd-compat/include/sys
+	echo '#include "/usr/include/sys/queue.h"'
+	echo '#include "/usr/include/sys/mount.h"'
+	;;
+esac > "openbsd-compat/include/sys/mount.h"
+
 AC_CHECK_DECLS([le32toh, le64toh, htole64], [], [], [
 #ifdef HAVE_SYS_TYPES_H
 # include <sys/types.h>
diff --git a/sftp-client.c b/sftp-client.c
index d8b364581..164ab4072 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -24,11 +24,9 @@
 
 #include <sys/types.h>
 #include <sys/queue.h>
-#ifdef HAVE_SYS_STATVFS_H
-#include <sys/statvfs.h>
-#endif
 #include <sys/stat.h>
 #include <sys/time.h>
+#include <sys/statvfs.h>
 #include <sys/uio.h>
 
 #include <dirent.h>
diff --git a/sftp-server.c b/sftp-server.c
index 2f725d265..feb2ad8ac 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -21,12 +21,8 @@
 #include <sys/resource.h>
 #include <sys/stat.h>
 #include <sys/time.h>
-#ifdef HAVE_SYS_MOUNT_H
 #include <sys/mount.h>
-#endif
-#ifdef HAVE_SYS_STATVFS_H
 #include <sys/statvfs.h>
-#endif
 
 #include <dirent.h>
 #include <errno.h>
diff --git a/sftp.c b/sftp.c
index f2be1fe38..b4d2c802d 100644
--- a/sftp.c
+++ b/sftp.c
@@ -21,10 +21,8 @@
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
-#include <sys/wait.h>
-#ifdef HAVE_SYS_STATVFS_H
 #include <sys/statvfs.h>
-#endif
+#include <sys/wait.h>
 
 #include <ctype.h>
 #include <errno.h>

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


More information about the openssh-commits mailing list