[openssh-commits] [openssh] 06/11: Create replacement sys/time.h if needed.

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Sep 5 18:10:26 AEST 2025


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

dtucker pushed a commit to branch master
in repository openssh.

commit 59b80707c6cf45230597a800e7d2ce6b00ce35b5
Author: Darren Tucker <dtucker at dtucker.net>
AuthorDate: Fri Sep 5 17:44:07 2025 +1000

    Create replacement sys/time.h if needed.
    
    Remove #ifdef HAVE_SYS_TIME_H wrapper.  ok djm@
---
 channels.c                | 4 +---
 clientloop.c              | 4 +---
 configure.ac              | 9 +++++----
 loginrec.c                | 4 +---
 openbsd-compat/bsd-misc.c | 4 +---
 packet.c                  | 4 +---
 scp.c                     | 4 +---
 serverloop.c              | 4 +---
 sftp-client.c             | 4 +---
 sftp-server.c             | 4 +---
 ssh-agent.c               | 4 +---
 ssh-keyscan.c             | 4 +---
 ssh-pkcs11-client.c       | 4 +---
 ssh-pkcs11-helper.c       | 4 +---
 ssh-pkcs11.c              | 4 +---
 sshconnect.c              | 4 +---
 sshd-session.c            | 4 +---
 sshd.c                    | 4 +---
 18 files changed, 22 insertions(+), 55 deletions(-)

diff --git a/channels.c b/channels.c
index b489cb9a9..2a4cb0e31 100644
--- a/channels.c
+++ b/channels.c
@@ -46,9 +46,7 @@
 #include <sys/ioctl.h>
 #include <sys/un.h>
 #include <sys/socket.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
diff --git a/clientloop.c b/clientloop.c
index 4511ecf10..cf51897d6 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -66,9 +66,7 @@
 #ifdef HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 #include <sys/socket.h>
 
 #include <ctype.h>
diff --git a/configure.ac b/configure.ac
index 6f48e5508..4c2a2b7ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -510,7 +510,6 @@ AC_CHECK_HEADERS([ \
 	sys/strtio.h \
 	sys/statvfs.h \
 	sys/sysmacros.h \
-	sys/time.h \
 	sys/timers.h \
 	sys/vfs.h \
 	time.h \
@@ -531,15 +530,17 @@ AC_CHECK_HEADERS([ \
 # the equivalent file.  This avoids having to wrap those includes in
 # '#ifdef HAVE_FOO_H'.  If we create any such headers, add the path to includes.
 compatincludes=no
-AC_CHECK_HEADERS([ifaddrs.h paths.h poll.h stdint.h util.h], [], [
+AC_CHECK_HEADERS([ifaddrs.h paths.h poll.h stdint.h sys/time.h util.h], [], [
     compatincludes="`pwd`/openbsd-compat/include"
-    mkdir -p "$compatincludes"
+    header="$compatincludes/$ac_header"
+    dir=`dirname "$header"`
+    mkdir -p "$dir"
     case "$ac_header" in
     poll.h) echo '#ifdef HAVE_SYS_POLL_H'
             echo '#include <sys/poll.h>'
             echo '#endif' ;;
     *)      ;;
-    esac >"$compatincludes/$ac_header"
+    esac >"$header"
 ])
 if test "$compatincludes" != "no"; then
     CPPFLAGS="$CPPFLAGS -I$compatincludes"
diff --git a/loginrec.c b/loginrec.c
index e50964de3..7d1c9dd43 100644
--- a/loginrec.c
+++ b/loginrec.c
@@ -129,9 +129,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 
 #include <netinet/in.h>
 
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c
index 669d2bb7e..aea2ba67f 100644
--- a/openbsd-compat/bsd-misc.c
+++ b/openbsd-compat/bsd-misc.c
@@ -21,9 +21,7 @@
 #ifdef HAVE_SYS_SELECT_H
 # include <sys/select.h>
 #endif
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 
 #include <fcntl.h>
 #include <string.h>
diff --git a/packet.c b/packet.c
index 6af84ed85..be16fd429 100644
--- a/packet.c
+++ b/packet.c
@@ -42,9 +42,7 @@
 #include <sys/types.h>
 #include "openbsd-compat/sys-queue.h"
 #include <sys/socket.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 
 #include <netinet/in.h>
 #include <netinet/ip.h>
diff --git a/scp.c b/scp.c
index be0acc3f5..f44470d76 100644
--- a/scp.c
+++ b/scp.c
@@ -78,9 +78,7 @@
 # include <sys/stat.h>
 #endif
 #include <poll.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 #include <sys/wait.h>
 #include <sys/uio.h>
 
diff --git a/serverloop.c b/serverloop.c
index ff207721d..c8b1fd6db 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -40,9 +40,7 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/socket.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 
 #include <netinet/in.h>
 
diff --git a/sftp-client.c b/sftp-client.c
index 880064c1e..6ff0db7f9 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -30,9 +30,7 @@
 #ifdef HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 #include <sys/uio.h>
 
 #include <dirent.h>
diff --git a/sftp-server.c b/sftp-server.c
index 0d1452102..777821acd 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -20,9 +20,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/resource.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 #ifdef HAVE_SYS_MOUNT_H
 #include <sys/mount.h>
 #endif
diff --git a/ssh-agent.c b/ssh-agent.c
index 10b19296c..36243f198 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -41,9 +41,7 @@
 #include <sys/stat.h>
 #include <sys/socket.h>
 #include <sys/wait.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 #ifdef HAVE_SYS_UN_H
 # include <sys/un.h>
 #endif
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index 46208f117..28451fc59 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -12,9 +12,7 @@
 #include <sys/types.h>
 #include "openbsd-compat/sys-queue.h"
 #include <sys/resource.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
diff --git a/ssh-pkcs11-client.c b/ssh-pkcs11-client.c
index 8be0d8aec..85afb62ac 100644
--- a/ssh-pkcs11-client.c
+++ b/ssh-pkcs11-client.c
@@ -19,9 +19,7 @@
 #include "includes.h"
 
 #include <sys/types.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 #include <sys/socket.h>
 
 #include <stdarg.h>
diff --git a/ssh-pkcs11-helper.c b/ssh-pkcs11-helper.c
index 279cd1df1..7ed4bdb76 100644
--- a/ssh-pkcs11-helper.c
+++ b/ssh-pkcs11-helper.c
@@ -18,9 +18,7 @@
 #include "includes.h"
 
 #include <sys/types.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 
 #include <stdlib.h>
 #include <errno.h>
diff --git a/ssh-pkcs11.c b/ssh-pkcs11.c
index b2d3cbd80..5167f89b8 100644
--- a/ssh-pkcs11.c
+++ b/ssh-pkcs11.c
@@ -20,9 +20,7 @@
 
 #ifdef ENABLE_PKCS11
 
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 
 #include <sys/types.h>
 #include <stdarg.h>
diff --git a/sshconnect.c b/sshconnect.c
index 97f65edc7..bef9f9bc3 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -19,9 +19,7 @@
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 
 #include <net/if.h>
 #include <netinet/in.h>
diff --git a/sshd-session.c b/sshd-session.c
index cd23c0530..b737e5911 100644
--- a/sshd-session.c
+++ b/sshd-session.c
@@ -35,9 +35,7 @@
 #ifdef HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 #include "openbsd-compat/sys-tree.h"
 #include "openbsd-compat/sys-queue.h"
 #include <sys/wait.h>
diff --git a/sshd.c b/sshd.c
index 23ca4e4fb..87601740b 100644
--- a/sshd.c
+++ b/sshd.c
@@ -32,9 +32,7 @@
 #ifdef HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
+#include <sys/time.h>
 #include "openbsd-compat/sys-tree.h"
 #include "openbsd-compat/sys-queue.h"
 #include <sys/wait.h>

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


More information about the openssh-commits mailing list