]> wimlib.net Git - wimlib/commitdiff
Fix problem where HAVE_NTFS_MNT_RDONLY would not get defined v1.4.0
authorEric Biggers <ebiggers3@gmail.com>
Sat, 18 May 2013 17:05:19 +0000 (12:05 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 18 May 2013 17:05:19 +0000 (12:05 -0500)
configure.ac
src/ntfs-3g_capture.c

index 1f46419ee20c324e0787be0acaa6de825142cd11..26398a9864c23b1501194e9fd984cf3bb2c379cc 100644 (file)
@@ -46,9 +46,26 @@ AM_PROG_CC_C_O
 AC_CANONICAL_HOST
 
 AC_CHECK_FUNCS([utimensat lutimes utime flock])
 AC_CANONICAL_HOST
 
 AC_CHECK_FUNCS([utimensat lutimes utime flock])
-AC_CHECK_HEADERS([endian.h byteswap.h sys/byteorder.h sys/endian.h \
-                 sys/param.h machine/endian.h alloca.h stdlib.h stdarg.h \
-                 errno.h attr/xattr.h utime.h sys/file.h glob.h])
+
+# Note: some of the following header checks are only to define the appropriate
+# HAVE_*_H macro so that the NTFS-3g headers don't get confused and try to skip
+# including certain headers.
+AC_CHECK_HEADERS([alloca.h             \
+                 attr/xattr.h          \
+                 byteswap.h            \
+                 endian.h              \
+                 errno.h               \
+                 glob.h                \
+                 machine/endian.h      \
+                 stdarg.h              \
+                 stdlib.h              \
+                 sys/byteorder.h       \
+                 sys/endian.h          \
+                 sys/file.h            \
+                 sys/param.h           \
+                 sys/times.h           \
+                 time.h                \
+                 utime.h])
 
 AC_CHECK_MEMBER([struct stat.st_mtim],
                [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
 
 AC_CHECK_MEMBER([struct stat.st_mtim],
                [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
index d81248ebf8354ba6f6fa268f844386630c063b60..bbf6749f16a4284b3e4fd9850ce9ecd4f5385017 100644 (file)
@@ -724,12 +724,22 @@ build_dentry_tree_ntfs(struct wim_dentry **root_p,
 
        DEBUG("Mounting NTFS volume `%s' read-only", device);
 
 
        DEBUG("Mounting NTFS volume `%s' read-only", device);
 
-#if defined(NTFS_MNT_RDONLY)
+/* NTFS-3g 2013 renamed the "read-only" mount flag from MS_RDONLY to
+ * NTFS_MNT_RDONLY.
+ *
+ * Unfortunately we can't check for defined(NTFS_MNT_RDONLY) because
+ * NTFS_MNT_RDONLY is an enumerated constant.  Also, the NTFS-3g headers don't
+ * seem to contain any explicit version information.  So we have to rely on a
+ * test done at configure time to detect whether NTFS_MNT_RDONLY should be used.
+ * */
+#ifdef HAVE_NTFS_MNT_RDONLY
        /* NTFS-3g 2013 */
        vol = ntfs_mount(device, NTFS_MNT_RDONLY);
 #elif defined(MS_RDONLY)
        /* NTFS-3g 2011, 2012 */
        vol = ntfs_mount(device, MS_RDONLY);
        /* NTFS-3g 2013 */
        vol = ntfs_mount(device, NTFS_MNT_RDONLY);
 #elif defined(MS_RDONLY)
        /* NTFS-3g 2011, 2012 */
        vol = ntfs_mount(device, MS_RDONLY);
+#else
+  #error "Can't find NTFS_MNT_RDONLY or MS_RDONLY flags"
 #endif
        if (!vol) {
                ERROR_WITH_ERRNO("Failed to mount NTFS volume `%s' read-only",
 #endif
        if (!vol) {
                ERROR_WITH_ERRNO("Failed to mount NTFS volume `%s' read-only",