summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Osipov <michael.osipov@siemens.com>2022-03-10 12:56:02 +0100
committerMichael Osipov <michael.osipov@siemens.com>2022-03-11 20:17:33 +0100
commitd773a6b96c9960dbdc22229f0f2450f3872281e4 (patch)
treed7840af001c31a44a0450a56b0baf960c70e8f16
parent3f8f054ed16a3daa81d1e27c6d9e4194bf0e7e0c (diff)
downloadlibarchive-d773a6b96c9960dbdc22229f0f2450f3872281e4.tar.gz
Add macro for dirfd() on HP-UX because no full POSIX.1-2008 coverage exists
HP-UX does neither provide a function nor a macro. This solution based on an issue with vim: https://github.com/vim/vim/issues/6838
-rw-r--r--libarchive/archive_read_disk_posix.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c
index d0e1f35c..2b39e672 100644
--- a/libarchive/archive_read_disk_posix.c
+++ b/libarchive/archive_read_disk_posix.c
@@ -109,6 +109,11 @@ __FBSDID("$FreeBSD$");
#define O_CLOEXEC 0
#endif
+#if defined(__hpux) && !defined(HAVE_DIRFD)
+#define dirfd(x) ((x)->__dd_fd)
+#define HAVE_DIRFD
+#endif
+
/*-
* This is a new directory-walking system that addresses a number
* of problems I've had with fts(3). In particular, it has no
@@ -2428,7 +2433,7 @@ tree_dir_next_posix(struct tree *t)
#else /* HAVE_FDOPENDIR */
if (tree_enter_working_dir(t) == 0) {
t->d = opendir(".");
-#if HAVE_DIRFD || defined(dirfd)
+#ifdef HAVE_DIRFD
__archive_ensure_cloexec_flag(dirfd(t->d));
#endif
}