[openssh-commits] [openssh] branch master updated: Add no-op implmentation of dirfd().

git+noreply at mindrot.org git+noreply at mindrot.org
Thu May 8 11:39:45 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 1511f113a Add no-op implmentation of dirfd().
1511f113a is described below

commit 1511f113a27d8aafe080aa6493cb3c0cf2b5abe0
Author: Darren Tucker <dtucker at dtucker.net>
AuthorDate: Thu May 8 11:38:24 2025 +1000

    Add no-op implmentation of dirfd().
    
    Fixes build on pre-POSIX.1 2008 systems.
---
 openbsd-compat/bsd-misc.c | 9 +++++++++
 openbsd-compat/bsd-misc.h | 6 ++++++
 2 files changed, 15 insertions(+)

diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c
index b26b4ba46..09bbb6049 100644
--- a/openbsd-compat/bsd-misc.c
+++ b/openbsd-compat/bsd-misc.c
@@ -158,6 +158,15 @@ utimensat(int fd, const char *path, const struct timespec times[2],
 }
 #endif
 
+#ifndef HAVE_DIRFD
+int
+dirfd(DIR *dir)
+{
+	errno = ENOSYS;
+	return -1;
+}
+#endif
+
 #ifndef HAVE_FCHOWNAT
 /*
  * A limited implementation of fchownat() that only implements the
diff --git a/openbsd-compat/bsd-misc.h b/openbsd-compat/bsd-misc.h
index edb0fcc8c..4ac73c73e 100644
--- a/openbsd-compat/bsd-misc.h
+++ b/openbsd-compat/bsd-misc.h
@@ -65,6 +65,12 @@ struct timeval {
 int utimes(const char *, struct timeval *);
 #endif /* HAVE_UTIMES */
 
+#ifndef HAVE_DIRFD
+#include <sys/types.h>
+#include <dirent.h>
+int dirfd(DIR *);
+#endif
+
 #ifndef AT_FDCWD
 # define AT_FDCWD (-2)
 #endif

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


More information about the openssh-commits mailing list