diff --git a/include/ntfs-3g/endians.h b/include/ntfs-3g/endians.h index c0067e64..eea88b69 100644 --- a/include/ntfs-3g/endians.h +++ b/include/ntfs-3g/endians.h @@ -300,4 +300,6 @@ #define le32_eq(a, b) ((a) == (b)) +#define le64_eq(a, b) ((a) == (b)) + #endif /* defined _NTFS_ENDIANS_H */ diff --git a/libntfs-3g/dir.c b/libntfs-3g/dir.c index 07332dc4..d14909e5 100644 --- a/libntfs-3g/dir.c +++ b/libntfs-3g/dir.c @@ -894,11 +894,11 @@ static u32 ntfs_interix_types(ntfs_inode *ni) if ((na->data_size >= (s64)sizeof(magic)) && (ntfs_attr_pread(na, 0, sizeof(magic), &magic) == sizeof(magic))) { - if (magic == INTX_SYMBOLIC_LINK) + if (le64_eq(magic, INTX_SYMBOLIC_LINK)) dt_type = NTFS_DT_LNK; - else if (magic == INTX_BLOCK_DEVICE) + else if (le64_eq(magic, INTX_BLOCK_DEVICE)) dt_type = NTFS_DT_BLK; - else if (magic == INTX_CHARACTER_DEVICE) + else if (le64_eq(magic, INTX_CHARACTER_DEVICE)) dt_type = NTFS_DT_CHR; } } diff --git a/src/lowntfs-3g.c b/src/lowntfs-3g.c index 3ff8b9de..0bded4e3 100644 --- a/src/lowntfs-3g.c +++ b/src/lowntfs-3g.c @@ -711,7 +711,7 @@ static int ntfs_fuse_getstat(struct SECURITY_CONTEXT *scx, ntfs_attr_close(na); goto exit; } - if (intx_file->magic == INTX_BLOCK_DEVICE && + if (le64_eq(intx_file->magic, INTX_BLOCK_DEVICE) && na->data_size == (s64)offsetof( INTX_FILE, device_end)) { stbuf->st_mode = S_IFBLK; @@ -720,7 +720,7 @@ static int ntfs_fuse_getstat(struct SECURITY_CONTEXT *scx, le64_to_cpu( intx_file->minor)); } - if (intx_file->magic == INTX_CHARACTER_DEVICE && + if (le64_eq(intx_file->magic, INTX_CHARACTER_DEVICE) && na->data_size == (s64)offsetof( INTX_FILE, device_end)) { stbuf->st_mode = S_IFCHR; @@ -729,7 +729,7 @@ static int ntfs_fuse_getstat(struct SECURITY_CONTEXT *scx, le64_to_cpu( intx_file->minor)); } - if (intx_file->magic == INTX_SYMBOLIC_LINK) + if (le64_eq(intx_file->magic, INTX_SYMBOLIC_LINK)) stbuf->st_mode = S_IFLNK; free(intx_file); } diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index de0f920e..c0321b9e 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -819,7 +819,7 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) ntfs_attr_close(na); goto exit; } - if (intx_file->magic == INTX_BLOCK_DEVICE && + if (le64_eq(intx_file->magic, INTX_BLOCK_DEVICE) && na->data_size == offsetof( INTX_FILE, device_end)) { stbuf->st_mode = S_IFBLK; @@ -828,7 +828,7 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) le64_to_cpu( intx_file->minor)); } - if (intx_file->magic == INTX_CHARACTER_DEVICE && + if (le64_eq(intx_file->magic, INTX_CHARACTER_DEVICE) && na->data_size == offsetof( INTX_FILE, device_end)) { stbuf->st_mode = S_IFCHR; @@ -837,7 +837,7 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) le64_to_cpu( intx_file->minor)); } - if (intx_file->magic == INTX_SYMBOLIC_LINK) + if (le64_eq(intx_file->magic, INTX_SYMBOLIC_LINK)) stbuf->st_mode = S_IFLNK; free(intx_file); }