From 6d4e6d9893a4e673881d7572e6be75e92418fd4a Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 4 Aug 2005 00:00:27 +0000 Subject: [PATCH] * fix ntfs_attr_open * update for 1.11.2 --- ChangeLog | 4 +++- configure.ac | 2 +- include/ntfs/attrib.h | 4 ++-- libntfs/attrib.c | 20 +++++++++++++++++--- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0237550..94819b73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -xx/xx/xxxx - 1.12.0-WIP +04/07/2005 - 1.11.2 - A lot of fixes and improvements. - ntfsls: fix showing not system files started with '$'. (Yura) - Move ntfs2utc and utc2ntfs from utils.[ch] to timeconv.h. (Yura) @@ -29,6 +29,8 @@ xx/xx/xxxx - 1.12.0-WIP compression block was incorrectly treated as not compressed. (Yura) - ntfsresize: fix for ntfs_rl_truncate() EIO: always set the correct size for $BadClus:$Bad, even if Windows set it incorrectly. (Szaka) + - Make ntfs_attr_open resolve attribute name for ntfs_attr struct + in case NULL passed instead of name. (Yura) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. diff --git a/configure.ac b/configure.ac index a0766ba5..65215d6d 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.12.0-WIP],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.11.2],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index 1785af1c..e59bf0f5 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -2,7 +2,7 @@ * attrib.h - Exports for attribute handling. Part of the Linux-NTFS project. * * Copyright (c) 2000-2004 Anton Altaparmakov - * Copyright (c) 2004 Yura Pakhuchiy + * Copyright (c) 2004-2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -261,7 +261,7 @@ extern void ntfs_attr_init(ntfs_attr *na, const BOOL non_resident, const u8 compression_unit); extern ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, - ntfschar *name, const u32 name_len); + ntfschar *name, u32 name_len); extern void ntfs_attr_close(ntfs_attr *na); extern s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 8a68410d..e594cfd2 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -322,7 +322,7 @@ void ntfs_attr_init(ntfs_attr *na, const BOOL non_resident, * both those cases @name_len is not used at all. */ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, - ntfschar *name, const u32 name_len) + ntfschar *name, u32 name_len) { ntfs_attr_search_ctx *ctx; ntfs_attr *na; @@ -348,20 +348,34 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, return NULL; } } - __ntfs_attr_init(na, ni, type, name, name_len); ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) { err = errno; goto err_out; } - if (ntfs_attr_lookup(type, name, name_len, 0, 0, NULL, 0, ctx)) { err = errno; goto put_err_out; } + a = ctx->attr; cs = a->flags & (ATTR_IS_COMPRESSED | ATTR_IS_SPARSE); + if (!name) { + if (a->name_length) { + name = ntfs_ucsndup((ntfschar*)((u8*)a + le16_to_cpu( + a->name_offset)), a->name_length); + if (!name) { + err = errno; + goto put_err_out; + } + name_len = a->name_length; + } else { + name = AT_UNNAMED; + name_len = 0; + } + } + __ntfs_attr_init(na, ni, type, name, name_len); if (a->non_resident) { ntfs_attr_init(na, TRUE, a->flags & ATTR_IS_COMPRESSED, a->flags & ATTR_IS_ENCRYPTED,