]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
Add no-op implmentation of dirfd().
authorDarren Tucker <dtucker@dtucker.net>
Thu, 8 May 2025 01:38:24 +0000 (11:38 +1000)
committerDarren Tucker <dtucker@dtucker.net>
Thu, 8 May 2025 01:39:02 +0000 (11:39 +1000)
Fixes build on pre-POSIX.1 2008 systems.

openbsd-compat/bsd-misc.c
openbsd-compat/bsd-misc.h

index b26b4ba4670ed4eade36411d6dfb61a284201b98..09bbb6049cacecad0244f4b1abb9992987e66e6d 100644 (file)
@@ -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
index edb0fcc8ca2bdb74a35331cbd7ee8c233f8188af..4ac73c73ee274805e1ee7446f0601c8a78266a2d 100644 (file)
@@ -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