]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Properly check if EXT2_IOC_GETFLAGS is actually usable.
authorJoerg Sonnenberger <joerg.sonnenberger@gmail.com>
Tue, 13 Dec 2011 23:07:17 +0000 (18:07 -0500)
committerJoerg Sonnenberger <joerg.sonnenberger@gmail.com>
Tue, 13 Dec 2011 23:07:17 +0000 (18:07 -0500)
OpenIndiana likes to install e2fsprogs, but doesn't provide a working
ioctl.

SVN-Revision: 3918

CMakeLists.txt
build/cmake/config.h.in
configure.ac
libarchive/archive_read_disk_entry_from_file.c
libarchive/archive_write_disk_posix.c
tar/write.c

index 910032600b04eca1af5a226d700dc375e01b65a7..04ee4dabe89b12b8dec8770e1076ff3e3754d1a3 100644 (file)
@@ -236,6 +236,11 @@ LA_CHECK_INCLUDE_FILE("direct.h" HAVE_DIRECT_H)
 LA_CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
 LA_CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H)
 LA_CHECK_INCLUDE_FILE("ext2fs/ext2_fs.h" HAVE_EXT2FS_EXT2_FS_H)
+
+CHECK_C_SOURCE_COMPILES("#include <sys/ioctl.h>
+#include <ext2fs/ext2_fs.h>
+int main(void) { return EXT2_IOC_GETFLAGS; }" HAVE_WORKING_EXT2_IOC_GETFLAGS)
+
 LA_CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H)
 LA_CHECK_INCLUDE_FILE("grp.h" HAVE_GRP_H)
 LA_CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
index 4e9b074b29b24e2b62821b7ea8ac3ca853556055..b1690515d7a8f47eaee301269e304b5c53b1add7 100644 (file)
@@ -970,6 +970,9 @@ typedef uint64_t uintmax_t;
 /* Define to 1 if you have the `wmemcpy' function. */
 #cmakedefine HAVE_WMEMCPY 1
 
+/* Define to 1 if you have a working EXT2_IOC_GETFLAGS */
+#cmakedefine HAVE_WORKING_EXT2_IOC_GETFLAGS 1
+
 /* Define to 1 if you have the <zlib.h> header file. */
 #cmakedefine HAVE_ZLIB_H 1
 
index 322cd0b06707c387ac41603dc865eb583d289ac5..d4977b03adc3cb38bae74770b060098d91602bf7 100644 (file)
@@ -208,6 +208,19 @@ AC_HEADER_DIRENT
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h copyfile.h ctype.h])
 AC_CHECK_HEADERS([errno.h ext2fs/ext2_fs.h fcntl.h grp.h])
+
+AC_CACHE_CHECK([whether EXT2_IOC_GETFLAGS is usable],
+    [ac_cv_have_decl_EXT2_IOC_GETFLAGS],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <sys/ioctl.h>
+@%:@include <ext2fs/ext2_fs.h>],
+                                   [int x = EXT2_IOC_GETFLAGS])],
+                  [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes])],
+                  [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [no])])])
+
+AS_VAR_IF([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes],
+    [AC_DEFINE_UNQUOTED([HAVE_WORKING_EXT2_IOC_GETFLAGS], [1],
+                    [Define to 1 if you have a working EXT2_IOC_GETFLAGS])])
+
 AC_CHECK_HEADERS([inttypes.h io.h langinfo.h limits.h])
 AC_CHECK_HEADERS([linux/fiemap.h linux/fs.h linux/magic.h])
 AC_CHECK_HEADERS([locale.h paths.h poll.h pwd.h regex.h signal.h stdarg.h])
index f0d67852769387401f9181d75d4a127e5dca045a..cc3915170735ca7a2538c1da11cc870a0194aa00 100644 (file)
@@ -182,7 +182,7 @@ archive_read_disk_entry_from_file(struct archive *_a,
                archive_entry_set_fflags(entry, st->st_flags, 0);
 #endif
 
-#ifdef EXT2_IOC_GETFLAGS
+#if defined(EXT2_IOC_GETFLAGS) && defined(HAVE_WORKING_EXT2_IOC_GETFLAGS)
        /* Linux requires an extra ioctl to pull the flags.  Although
         * this is an extra step, it has a nice side-effect: We get an
         * open file descriptor which we can use in the subsequent lookups. */
index 51b67e86a75bc37bf3245126c37e64d027129cee..98356a9429e158ebaf2c74bce72bb2b8af936896 100644 (file)
@@ -2359,7 +2359,7 @@ set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
        return (ARCHIVE_WARN);
 }
 
-#elif defined(EXT2_IOC_GETFLAGS) && defined(EXT2_IOC_SETFLAGS)
+#elif defined(EXT2_IOC_GETFLAGS) && defined(EXT2_IOC_SETFLAGS) && defined(HAVE_WORKING_EXT2_IOC_GETFLAGS)
 /*
  * Linux uses ioctl() to read and write file flags.
  */
index 9fb9eac375a80b7e93b03e75d9ed876689a87eed..711c3e7184eaac6f3ae229305bba34245f0a46cb 100644 (file)
@@ -860,7 +860,7 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path)
                        continue;
 #endif
 
-#if defined(EXT2_IOC_GETFLAGS) && defined(EXT2_NODUMP_FL)
+#if defined(EXT2_IOC_GETFLAGS) && defined(EXT2_NODUMP_FL) && defined(HAVE_WORKING_EXT2_IOC_GETFLAGS)
                /* Linux uses ioctl to read flags. */
                if (bsdtar->option_honor_nodump) {
                        int fd = open(name, O_RDONLY | O_NONBLOCK | O_BINARY);