[openssh-commits] [openssh] branch master updated: Handle systems that don't have st_mtim.

git+noreply at mindrot.org git+noreply at mindrot.org
Mon May 5 20:51:21 AEST 2025


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

dtucker pushed a commit to branch master
in repository openssh.

The following commit(s) were added to refs/heads/master by this push:
     new 61525ba96 Handle systems that don't have st_mtim.
61525ba96 is described below

commit 61525ba967ac1bb7394ea0792aa6030bcbbad049
Author: Darren Tucker <dtucker at dtucker.net>
AuthorDate: Mon May 5 20:45:42 2025 +1000

    Handle systems that don't have st_mtim.
    
    Ignores nanoseconds, but it's checking for >1h old so a few nanoseconds
    shouldn't matter much.  Fixes build on Mac OS X.
---
 misc-agent.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/misc-agent.c b/misc-agent.c
index a8605302e..f13ccdf26 100644
--- a/misc-agent.c
+++ b/misc-agent.c
@@ -270,7 +270,7 @@ agent_cleanup_stale(const char *homedir, int ignore_hosthash)
 	struct dirent *dp;
 	struct stat sb;
 	char *prefix = NULL, *dirpath, *path;
-	struct timespec now, sub;
+	struct timespec now, sub, *mtimp = NULL;
 
 	/* Only consider sockets last modified > 1 hour ago */
 	if (clock_gettime(CLOCK_REALTIME, &now) != 0) {
@@ -309,7 +309,14 @@ agent_cleanup_stale(const char *homedir, int ignore_hosthash)
 		}
 		if (!S_ISSOCK(sb.st_mode))
 			continue;
-		if (timespeccmp(&sb.st_mtim, &now, >)) {
+#ifdef HAVE_STRUCT_STAT_ST_MTIM
+		mtimp = &sb.st_mtim;
+#else
+		sub.tv_sec = sb.st_mtime;
+		sub.tv_nsec = 0;
+		mtimp = ⊂
+#endif
+		if (timespeccmp(mtimp, &now, >)) {
 			debug3_f("Ignoring recent socket \"%s/%s\"",
 			    dirpath, dp->d_name);
 			continue;

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


More information about the openssh-commits mailing list