From 0b378fd177be700f0cb47a653295d70c2fe45a9d Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Mon, 8 Feb 2016 18:32:24 +0100 Subject: [PATCH 01/17] ntfslabel.c: Fix incorrect label buffer being NULL-terminated. The UTF-16LE label buffer containing the result of mbs2ucs is the one that should be NULL-terminated when the label is longer than permitted. Not the input buffer, which is a function parameter assumed to be NULL-terminated anyway. --- ntfsprogs/ntfslabel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index 77a34f08..e2d36c8e 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -389,7 +389,7 @@ static int change_label(ntfs_volume *vol, char *label) (unsigned)(label_len - (0x100 / sizeof(ntfschar)))); label_len = 0x100 / sizeof(ntfschar); - label[label_len] = 0; + new_label[label_len] = const_cpu_to_le16(0); } if(!opts.noaction) From 33cb3087b590637c6b471d7339037b7ff2322b08 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Mon, 8 Feb 2016 18:42:53 +0100 Subject: [PATCH 02/17] efs.c: Fix incorrect type of local variables 'newsize' and 'oldsize'. These variable are only ever assigned to/from s64 values, so their type should be s64, not u64. This fixes a compiler warning about signed/unsigned comparison. --- libntfs-3g/efs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs-3g/efs.c b/libntfs-3g/efs.c index 14a2cb51..443426cf 100644 --- a/libntfs-3g/efs.c +++ b/libntfs-3g/efs.c @@ -321,8 +321,8 @@ int ntfs_set_efs_info(ntfs_inode *ni, const char *value, size_t size, int ntfs_efs_fixup_attribute(ntfs_attr_search_ctx *ctx, ntfs_attr *na) { - u64 newsize; - u64 oldsize; + s64 newsize; + s64 oldsize; le16 appended_bytes; u16 padding_length; ntfs_inode *ni; From abb226614775d870bee474ef084850957ddc8d3f Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Thu, 11 Feb 2016 13:52:59 +0100 Subject: [PATCH 03/17] mft.c: Fix compiler warning about mismatching format/argument type. The expression is promoted to 'int' implicitly so we explicitly cast it to 'u8'. --- libntfs-3g/mft.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs-3g/mft.c b/libntfs-3g/mft.c index b9285e2f..304c5baa 100644 --- a/libntfs-3g/mft.c +++ b/libntfs-3g/mft.c @@ -554,7 +554,7 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni) "data_pos 0x%llx, bit 0x%llx, " "*byte 0x%hhx, b %u.\n", size, (long long)data_pos, (long long)bit, - byte ? *byte : -1, b); + (u8) (byte ? *byte : -1), b); for (; bit < size && data_pos + bit < pass_end; bit &= ~7ull, bit += 8) { /* @@ -581,7 +581,7 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni) "data_pos 0x%llx, bit 0x%llx, " "*byte 0x%hhx, b %u.\n", size, (long long)data_pos, (long long)bit, - byte ? *byte : -1, b); + (u8) (byte ? *byte : -1), b); data_pos += size; /* * If the end of the pass has not been reached yet, From f463919310f9a6e263e6e3bce9ae3bc059c86e92 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Thu, 11 Feb 2016 14:06:53 +0100 Subject: [PATCH 04/17] ntfs-3g_common.h: Fix improper type for 'dmtime' in ntfs_fuse_context_t. This field is always assigned a signed value, and compared to other signed values (ntfs_time values are signed little-endian 32-bit integers). This fixes two compiler warnings about signed/unsigned comparison. --- src/ntfs-3g_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ntfs-3g_common.h b/src/ntfs-3g_common.h index e68c6992..6e573a65 100644 --- a/src/ntfs-3g_common.h +++ b/src/ntfs-3g_common.h @@ -118,7 +118,7 @@ typedef struct { unsigned int dmask; ntfs_fuse_streams_interface streams; ntfs_atime_t atime; - u64 dmtime; + s64 dmtime; BOOL ro; BOOL show_sys_files; BOOL hide_hid_files; From a207d4e86a133bdbfd2f08134c49d11c9240fb75 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Thu, 11 Feb 2016 14:19:41 +0100 Subject: [PATCH 05/17] endians.h: Cast the result of const endianness macros to the right type. This fixes compiler warnings emitted when you compare an le32 value with e.g. 'const_cpu_to_le32(-1)' on a little-endian system, because previously the expansion of the macro expression 'const_cpu_to_le32(-1)' would be '(-1)' on a little-endian system but '(u32)((((u32)(-1) & 0xff000000u) >> 24) | (((u32)(-1) & 0x00ff0000u) >> 8) | (((u32)(-1) & 0x0000ff00u) << 8) | (((u32)(-1) & 0x000000ffu) << 24))' on a big-endian system, i.e. the type of the expanded expression would be 'int' (signed) in the little-endian case but 'u32' (unsigned) in the big-endian case. With this commit the type of the expanded expression will be 'le32' in both the little-endian and the big-endian case. --- include/ntfs-3g/endians.h | 48 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/include/ntfs-3g/endians.h b/include/ntfs-3g/endians.h index f7eb6c4f..b93761d3 100644 --- a/include/ntfs-3g/endians.h +++ b/include/ntfs-3g/endians.h @@ -264,36 +264,36 @@ /* Constant endianness conversion defines. */ -#define const_le16_to_cpu(x) __constant_le16_to_cpu(x) -#define const_le32_to_cpu(x) __constant_le32_to_cpu(x) -#define const_le64_to_cpu(x) __constant_le64_to_cpu(x) +#define const_le16_to_cpu(x) ((u16) __constant_le16_to_cpu(x)) +#define const_le32_to_cpu(x) ((u32) __constant_le32_to_cpu(x)) +#define const_le64_to_cpu(x) ((u64) __constant_le64_to_cpu(x)) -#define const_cpu_to_le16(x) __constant_cpu_to_le16(x) -#define const_cpu_to_le32(x) __constant_cpu_to_le32(x) -#define const_cpu_to_le64(x) __constant_cpu_to_le64(x) +#define const_cpu_to_le16(x) ((le16) __constant_cpu_to_le16(x)) +#define const_cpu_to_le32(x) ((le32) __constant_cpu_to_le32(x)) +#define const_cpu_to_le64(x) ((le64) __constant_cpu_to_le64(x)) -#define const_sle16_to_cpu(x) __constant_le16_to_cpu((le16) x) -#define const_sle32_to_cpu(x) __constant_le32_to_cpu((le32) x) -#define const_sle64_to_cpu(x) __constant_le64_to_cpu((le64) x) +#define const_sle16_to_cpu(x) ((s16) __constant_le16_to_cpu((le16) x)) +#define const_sle32_to_cpu(x) ((s32) __constant_le32_to_cpu((le32) x)) +#define const_sle64_to_cpu(x) ((s64) __constant_le64_to_cpu((le64) x)) -#define const_cpu_to_sle16(x) __constant_cpu_to_le16((u16) x) -#define const_cpu_to_sle32(x) __constant_cpu_to_le32((u32) x) -#define const_cpu_to_sle64(x) __constant_cpu_to_le64((u64) x) +#define const_cpu_to_sle16(x) ((sle16) __constant_cpu_to_le16((u16) x)) +#define const_cpu_to_sle32(x) ((sle32) __constant_cpu_to_le32((u32) x)) +#define const_cpu_to_sle64(x) ((sle64) __constant_cpu_to_le64((u64) x)) -#define const_be16_to_cpu(x) __constant_be16_to_cpu(x) -#define const_be32_to_cpu(x) __constant_be32_to_cpu(x) -#define const_be64_to_cpu(x) __constant_be64_to_cpu(x) +#define const_be16_to_cpu(x) ((u16) __constant_be16_to_cpu(x))) +#define const_be32_to_cpu(x) ((u32) __constant_be32_to_cpu(x))) +#define const_be64_to_cpu(x) ((u64) __constant_be64_to_cpu(x))) -#define const_cpu_to_be16(x) __constant_cpu_to_be16(x) -#define const_cpu_to_be32(x) __constant_cpu_to_be32(x) -#define const_cpu_to_be64(x) __constant_cpu_to_be64(x) +#define const_cpu_to_be16(x) ((be16) __constant_cpu_to_be16(x)) +#define const_cpu_to_be32(x) ((be32) __constant_cpu_to_be32(x)) +#define const_cpu_to_be64(x) ((be64) __constant_cpu_to_be64(x)) -#define const_sbe16_to_cpu(x) __constant_be16_to_cpu((be16) x) -#define const_sbe32_to_cpu(x) __constant_be32_to_cpu((be32) x) -#define const_sbe64_to_cpu(x) __constant_be64_to_cpu((be64) x) +#define const_sbe16_to_cpu(x) ((s16) __constant_be16_to_cpu((be16) x)) +#define const_sbe32_to_cpu(x) ((s32) __constant_be32_to_cpu((be32) x)) +#define const_sbe64_to_cpu(x) ((s64) __constant_be64_to_cpu((be64) x)) -#define const_cpu_to_sbe16(x) __constant_cpu_to_be16((u16) x) -#define const_cpu_to_sbe32(x) __constant_cpu_to_be32((u32) x) -#define const_cpu_to_sbe64(x) __constant_cpu_to_be64((u64) x) +#define const_cpu_to_sbe16(x) ((sbe16) __constant_cpu_to_be16((u16) x)) +#define const_cpu_to_sbe32(x) ((sbe32) __constant_cpu_to_be32((u32) x)) +#define const_cpu_to_sbe64(x) ((sbe64) __constant_cpu_to_be64((u64) x)) #endif /* defined _NTFS_ENDIANS_H */ From 5edb3ec9203c93e9fc95f4809fc17570bfc19f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Fri, 12 Feb 2016 17:03:53 +0100 Subject: [PATCH 06/17] Closed the bad sector inode after updating the list Unlike in most cases, the bad sector inode has to be closed if it was updated and required MFT extents (when there are a lot of bad sectors and some of them were outside the truncated partition). Not doing so causes the inode to not be fully synced to device. --- ntfsprogs/ntfsresize.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 9b67bce5..af5da8e4 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -5,7 +5,7 @@ * Copyright (c) 2002-2005 Anton Altaparmakov * Copyright (c) 2002-2003 Richard Russon * Copyright (c) 2007 Yura Pakhuchiy - * Copyright (c) 2011-2015 Jean-Pierre Andre + * Copyright (c) 2011-2016 Jean-Pierre Andre * * This utility will resize an NTFS volume without data loss. * @@ -404,7 +404,7 @@ static void version(void) printf("Copyright (c) 2002-2005 Anton Altaparmakov\n"); printf("Copyright (c) 2002-2003 Richard Russon\n"); printf("Copyright (c) 2007 Yura Pakhuchiy\n"); - printf("Copyright (c) 2011-2015 Jean-Pierre Andre\n"); + printf("Copyright (c) 2011-2016 Jean-Pierre Andre\n"); printf("\n%s\n%s%s", ntfs_gpl, ntfs_bugs, ntfs_home); } @@ -2537,8 +2537,6 @@ static void lookup_data_attr(ntfs_volume *vol, ntfs_ucsfree(ustr); } -#if CLEAN_EXIT - static void close_inode_and_context(ntfs_attr_search_ctx *ctx) { ntfs_inode *ni; @@ -2551,8 +2549,6 @@ static void close_inode_and_context(ntfs_attr_search_ctx *ctx) ntfs_inode_close(ni); } -#endif /* CLEAN_EXIT */ - static int check_bad_sectors(ntfs_volume *vol) { ntfs_attr_search_ctx *ctx; @@ -2619,11 +2615,7 @@ static void truncate_badclust_file(ntfs_resize_t *resize) resize->mref = FILE_BadClus; truncate_badclust_bad_attr(resize); -#if CLEAN_EXIT close_inode_and_context(resize->ctx); -#else - ntfs_attr_put_search_ctx(resize->ctx); -#endif } /** From 6548d91f733cf98f984df2adda0014aa1fb24c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Fri, 12 Feb 2016 17:13:21 +0100 Subject: [PATCH 07/17] Closed the volume when a resizing is done Closing the volume is the way to sync the MFT to disk. When not doing so, the MFT runlists in $DATA and $Bitmap are not synced if they have been updated in the second resizing stage relative to runlists which have grown outside their original MFT record. --- ntfsprogs/ntfsresize.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index af5da8e4..6e592816 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -4609,11 +4609,9 @@ int main(int argc, char **argv) printf("Successfully resized NTFS on device '%s'.\n", vol->dev->d_name); if (resize.shrink) printf("%s", resize_important_msg); -#if CLEAN_EXIT if (resize.lcn_bitmap.bm) free(resize.lcn_bitmap.bm); if (vol) ntfs_umount(vol,0); -#endif return 0; } From f655192f26277d1e0c13103141a45ccdad3cca05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Fri, 12 Feb 2016 17:24:27 +0100 Subject: [PATCH 08/17] Updated the drivers copyrights Extend the copyright to 2016 --- src/lowntfs-3g.c | 2 +- src/ntfs-3g.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lowntfs-3g.c b/src/lowntfs-3g.c index 096ac192..0bb38f97 100644 --- a/src/lowntfs-3g.c +++ b/src/lowntfs-3g.c @@ -227,7 +227,7 @@ static const char *usage_msg = "\n" "Copyright (C) 2005-2007 Yura Pakhuchiy\n" "Copyright (C) 2006-2009 Szabolcs Szakacsits\n" -"Copyright (C) 2007-2015 Jean-Pierre Andre\n" +"Copyright (C) 2007-2016 Jean-Pierre Andre\n" "Copyright (C) 2009 Erik Larsson\n" "\n" "Usage: %s [-o option[,...]] \n" diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index 1e56de72..268b0569 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -171,7 +171,7 @@ static const char *usage_msg = "\n" "Copyright (C) 2005-2007 Yura Pakhuchiy\n" "Copyright (C) 2006-2009 Szabolcs Szakacsits\n" -"Copyright (C) 2007-2015 Jean-Pierre Andre\n" +"Copyright (C) 2007-2016 Jean-Pierre Andre\n" "Copyright (C) 2009 Erik Larsson\n" "\n" "Usage: %s [-o option[,...]] \n" From d2197785f4151fd657a1c198f69b44e11a608522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Mon, 15 Feb 2016 11:54:33 +0100 Subject: [PATCH 09/17] Avoided pointer cast when checking record types Some compilers issue warning when casting a pointer to a pointer to a different type. When checking a record magic, there is no need to cast pointers. --- libntfs-3g/volume.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libntfs-3g/volume.c b/libntfs-3g/volume.c index 7f22ad7e..916f1c02 100644 --- a/libntfs-3g/volume.c +++ b/libntfs-3g/volume.c @@ -964,13 +964,13 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, ntfs_mount_flags flags) mrec = (MFT_RECORD*)(m + i * vol->mft_record_size); if (mrec->flags & MFT_RECORD_IN_USE) { - if (ntfs_is_baad_recordp(&mrec->magic)) { + if (ntfs_is_baad_record(mrec->magic)) { ntfs_log_error("$MFT error: Incomplete multi " "sector transfer detected in " "'%s'.\n", s); goto io_error_exit; } - if (!ntfs_is_mft_recordp(&mrec->magic)) { + if (!ntfs_is_mft_record(mrec->magic)) { ntfs_log_error("$MFT error: Invalid mft " "record for '%s'.\n", s); goto io_error_exit; @@ -978,13 +978,13 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, ntfs_mount_flags flags) } mrec2 = (MFT_RECORD*)(m2 + i * vol->mft_record_size); if (mrec2->flags & MFT_RECORD_IN_USE) { - if (ntfs_is_baad_recordp(&mrec2->magic)) { + if (ntfs_is_baad_record(mrec2->magic)) { ntfs_log_error("$MFTMirr error: Incomplete " "multi sector transfer " "detected in '%s'.\n", s); goto io_error_exit; } - if (!ntfs_is_mft_recordp(&mrec2->magic)) { + if (!ntfs_is_mft_record(mrec2->magic)) { ntfs_log_error("$MFTMirr error: Invalid mft " "record for '%s'.\n", s); goto io_error_exit; From 941ec4762f944db907dd63b47d41c287b987ecea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Mon, 15 Feb 2016 12:02:10 +0100 Subject: [PATCH 10/17] Silenced a compiler warning for different types Some compilers issue a warning when the alternatives in a "? :" expression have different signedness. --- ntfsprogs/ntfsclone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 5a92dafb..cbbbc854 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1011,7 +1011,7 @@ static void restore_image(void) Printf("Restoring NTFS from image ...\n"); progress_init(&progress, p_counter, opt.std_out ? - sle64_to_cpu(image_hdr.nr_clusters) + 1 : + (u64)sle64_to_cpu(image_hdr.nr_clusters) + 1 : le64_to_cpu(image_hdr.inuse) + 1, 100); From 4f6fb651c2a9a902ddc1839aaac886254c5e6fb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Mon, 15 Feb 2016 12:07:28 +0100 Subject: [PATCH 11/17] Silenced a compiler warning for possibly uninitialized pointer Some compilers issue a warning when a pointer is initialized in both alternatives of a condition. Force an extra initialization to avoid such warnings. --- ntfsprogs/ntfsrecover.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ntfsprogs/ntfsrecover.c b/ntfsprogs/ntfsrecover.c index 928f276c..c2b6c4ee 100644 --- a/ntfsprogs/ntfsrecover.c +++ b/ntfsprogs/ntfsrecover.c @@ -1090,6 +1090,7 @@ static const struct BUFFER *findprevious(CONTEXT *ctx, const struct BUFFER *buf) error = FALSE; prevblk = buf->num; + prevbuf = (struct BUFFER*)NULL; skipped = 0; do { prevmiddle = FALSE; From 1ae297378c95e94723be49f481ba4e9d0cbe033c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Mon, 15 Feb 2016 16:32:03 +0100 Subject: [PATCH 12/17] Version 2016.2.15 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index c2cf8cd1..48fe9b55 100644 --- a/configure.ac +++ b/configure.ac @@ -24,8 +24,8 @@ # Autoconf AC_PREREQ(2.59) -AC_INIT([ntfs-3g],[2015.3.14],[ntfs-3g-devel@lists.sf.net]) -LIBNTFS_3G_VERSION="86" +AC_INIT([ntfs-3g],[2016.2.15],[ntfs-3g-devel@lists.sf.net]) +LIBNTFS_3G_VERSION="87" AC_CONFIG_SRCDIR([src/ntfs-3g.c]) # Environment From 62b5c91420814f4f7962441ddebb9eb2e04d6697 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Tue, 16 Feb 2016 09:30:49 +0100 Subject: [PATCH 13/17] Fix compiler warnings about mismatching printf format / argument type. For 64-bit (e.g. x86_64) Linux the 64-bit wide types resolve to long, not long long as is the case in 32-bit (e.g. i386) Linux. So we need an explicit cast to long long for 64-bit types since the format string must specify the 'll' modifier in order to print 64-bit values. --- libntfs-3g/attrib.c | 3 ++- ntfsprogs/mkntfs.c | 8 +++++--- ntfsprogs/ntfsundelete.c | 2 +- ntfsprogs/utils.c | 10 +++++++--- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/libntfs-3g/attrib.c b/libntfs-3g/attrib.c index 25e7674b..a5a6549a 100644 --- a/libntfs-3g/attrib.c +++ b/libntfs-3g/attrib.c @@ -2373,7 +2373,8 @@ int ntfs_attr_pclose(ntfs_attr *na) BOOL compressed; ntfs_log_enter("Entering for inode 0x%llx, attr 0x%x.\n", - na->ni->mft_no, le32_to_cpu(na->type)); + (unsigned long long)na->ni->mft_no, + le32_to_cpu(na->type)); if (!na || !na->ni || !na->ni->vol) { errno = EINVAL; diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 7b39fac7..5eb7d4fb 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3704,7 +3704,8 @@ static BOOL mkntfs_override_vol_params(ntfs_volume *vol) (long long)(volume_size / 1024)); return FALSE; } - ntfs_log_debug("volume size = %llikiB\n", volume_size / 1024); + ntfs_log_debug("volume size = %llikiB\n", + (long long)(volume_size / 1024)); /* If user didn't specify the cluster size, determine it now. */ if (!vol->cluster_size) { /* @@ -3789,7 +3790,8 @@ static BOOL mkntfs_override_vol_params(ntfs_volume *vol) return FALSE; } ntfs_log_debug("number of clusters = %llu (0x%llx)\n", - vol->nr_clusters, vol->nr_clusters); + (unsigned long long)vol->nr_clusters, + (unsigned long long)vol->nr_clusters); /* Number of clusters must fit within 32 bits (Win2k limitation). */ if (vol->nr_clusters >> 32) { if (vol->cluster_size >= 65536) { @@ -3868,7 +3870,7 @@ static BOOL mkntfs_initialize_bitmaps(void) i = (g_lcn_bitmap_byte_size + g_vol->cluster_size - 1) & ~(g_vol->cluster_size - 1); ntfs_log_debug("g_lcn_bitmap_byte_size = %i, allocated = %llu\n", - g_lcn_bitmap_byte_size, i); + g_lcn_bitmap_byte_size, (unsigned long long)i); g_dynamic_buf_size = mkntfs_get_page_size(); g_dynamic_buf = (u8*)ntfs_calloc(g_dynamic_buf_size); if (!g_dynamic_buf) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 7340dc50..d479ec15 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -2358,7 +2358,7 @@ static int copy_mft(ntfs_volume *vol, long long mft_begin, long long mft_end) mft_end = min(mft_end, nr_mft_records - 1); ntfs_log_debug("MFT records:\n"); - ntfs_log_debug("\tTotal: %8lld\n", nr_mft_records); + ntfs_log_debug("\tTotal: %8lld\n", (long long)nr_mft_records); ntfs_log_debug("\tBegin: %8lld\n", mft_begin); ntfs_log_debug("\tEnd: %8lld\n", mft_end); diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 20ff786d..45a03a4f 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -420,7 +420,8 @@ int utils_parse_range(const char *string, s64 *start, s64 *finish, BOOL scale) if (middle) { if (middle[1] == 0) { b = LONG_MAX; // XXX ULLONG_MAX - ntfs_log_debug("Range has no end, defaulting to %lld.\n", b); + ntfs_log_debug("Range has no end, defaulting to " + "%lld.\n", (long long)b); } else { if (!utils_parse_size(middle+1, &b, scale)) return 0; @@ -429,7 +430,8 @@ int utils_parse_range(const char *string, s64 *start, s64 *finish, BOOL scale) b = a; } - ntfs_log_debug("Range '%s' = %lld - %lld\n", string, a, b); + ntfs_log_debug("Range '%s' = %lld - %lld\n", string, (long long)a, + (long long)b); *start = a; *finish = b; @@ -813,7 +815,9 @@ int utils_mftrec_in_use(ntfs_volume *vol, MFT_REF mref) bit = 1 << (mref & 7); byte = (mref >> 3) & (sizeof(buffer) - 1); - ntfs_log_debug("cluster = %lld, bmpmref = %lld, byte = %d, bit = %d, in use %d\n", mref, bmpmref, byte, bit, buffer[byte] & bit); + ntfs_log_debug("cluster = %lld, bmpmref = %lld, byte = %d, bit = %d, " + "in use %d\n", (long long) mref, (long long) bmpmref, + byte, bit, buffer[byte] & bit); return (buffer[byte] & bit); } From 9dee6591905d39283046136ebe87529157757202 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Tue, 16 Feb 2016 09:38:12 +0100 Subject: [PATCH 14/17] ntfsrecover.c: Fix compiler warning about uninitialized 'savebuf' usage. The previous fix for the warning referred to 'prevbuf' being used uninitialized and this is also what the compiler says. However initializing 'prevbuf' doesn't make the warning go away and further testing revealed that it is really 'savebuf' being possibly used prior to initialization that is the source of the warning (the incorrect warning message is probably an optimization-related gcc bug). So replace previous ineffective fix with explicit initialization of 'savebuf'. --- ntfsprogs/ntfsrecover.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsrecover.c b/ntfsprogs/ntfsrecover.c index c2b6c4ee..aae96adf 100644 --- a/ntfsprogs/ntfsrecover.c +++ b/ntfsprogs/ntfsrecover.c @@ -1090,7 +1090,7 @@ static const struct BUFFER *findprevious(CONTEXT *ctx, const struct BUFFER *buf) error = FALSE; prevblk = buf->num; - prevbuf = (struct BUFFER*)NULL; + savebuf = (struct BUFFER*)NULL; skipped = 0; do { prevmiddle = FALSE; From 9d1360b28222065b5e9d78343aec597f3830cf47 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Tue, 16 Feb 2016 20:29:56 +0100 Subject: [PATCH 15/17] endians.h: Fix bad assumption of valid __BYTE_ORDER__ values. On the OpenIndiana Hipster distribution, compiling with GCC 4.9 would fail because __BYTE_ORDER__ was defined but not to any of the values assumed to be associated with this define (__LITTLE_ENDIAN__ or __BIG_ENDIAN__). Instead it was defined to either __ORDER_LITTLE_ENDIAN__ or __ORDER_BIG_ENDIAN__. This caused compilation to fail. Fixed by checking that all referenced defines are in fact defined before using them and adding an additional #elif clause for this newly discovered condition. --- include/ntfs-3g/endians.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/ntfs-3g/endians.h b/include/ntfs-3g/endians.h index b93761d3..948295f2 100644 --- a/include/ntfs-3g/endians.h +++ b/include/ntfs-3g/endians.h @@ -61,10 +61,16 @@ # define __BYTE_ORDER BYTE_ORDER # define __LITTLE_ENDIAN LITTLE_ENDIAN # define __BIG_ENDIAN BIG_ENDIAN -# elif defined(__BYTE_ORDER__) +# elif defined(__BYTE_ORDER__) && defined(__LITTLE_ENDIAN__) && \ + defined(__BIG_ENDIAN__) # define __BYTE_ORDER __BYTE_ORDER__ # define __LITTLE_ENDIAN __LITTLE_ENDIAN__ # define __BIG_ENDIAN __BIG_ENDIAN__ +# elif defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \ + defined(__ORDER_BIG_ENDIAN__) +# define __BYTE_ORDER __BYTE_ORDER__ +# define __LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__ +# define __BIG_ENDIAN __ORDER_BIG_ENDIAN__ # elif (defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)) || \ defined(WORDS_LITTLEENDIAN) # define __BYTE_ORDER 1 From 038a45a8a1c52348b80a36cc8d47034298af7fe3 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Tue, 16 Feb 2016 20:43:00 +0100 Subject: [PATCH 16/17] Fix compilation errors on OpenIndiana caused by missing limit macros. --- ntfsprogs/ntfsmove.c | 3 +++ ntfsprogs/ntfswipe.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index 123041dd..3cf695a8 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -36,6 +36,9 @@ #ifdef HAVE_STRING_H #include #endif +#ifdef HAVE_LIMITS_H +#include +#endif #include "types.h" #include "attrib.h" diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 634f3154..52e075d1 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -53,6 +53,9 @@ #ifdef HAVE_TIME_H #include #endif +#ifdef HAVE_LIMITS_H +#include +#endif #include "ntfswipe.h" #include "types.h" From 6b5e47f094862f729d56baa8cf88827fd4493728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Mon, 22 Feb 2016 08:28:50 +0100 Subject: [PATCH 17/17] Version 2016.2.22 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 48fe9b55..d31a9cda 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ # Autoconf AC_PREREQ(2.59) -AC_INIT([ntfs-3g],[2016.2.15],[ntfs-3g-devel@lists.sf.net]) +AC_INIT([ntfs-3g],[2016.2.22],[ntfs-3g-devel@lists.sf.net]) LIBNTFS_3G_VERSION="87" AC_CONFIG_SRCDIR([src/ntfs-3g.c])