Skip to content

Instantly share code, notes, and snippets.

@NattyNarwhal
Last active July 2, 2018 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NattyNarwhal/1e711e742d2ffc6e0e053da784698cdb to your computer and use it in GitHub Desktop.
Save NattyNarwhal/1e711e742d2ffc6e0e053da784698cdb to your computer and use it in GitHub Desktop.
libarchive on AIX

Compiles cleanly. I tested against git master. Follow this:

bash build/autogen.sh # if you cloned from git instead of using a release tarball
CONFIG_SHELL=`which bash` AR=/usr/bin/ar NM=/usr/bin/nm LD=/usr/bin/ld ./configure
gmake # you can parallelize this with -j<NUMPROCS> - i recommend setting that to CPU cores

You will have to apply a patch included with this document; a real solution would be to fix it in configure.ac, but this is left as an exercise to the reader.

diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c
index cdf7541..51bc0b1 100644
--- a/libarchive/archive_read_disk_posix.c
+++ b/libarchive/archive_read_disk_posix.c
@@ -2363,7 +2363,8 @@ 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)
+/* AIX defined dirfd for years but it wasn't in libc until AIX 7.1, WTF?*/
+#if (HAVE_DIRFD || defined(dirfd)) && !defined(_AIX)
__archive_ensure_cloexec_flag(dirfd(t->d));
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment