From c972652876ae229f32f3e7536b049d945bdfbf2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Sat, 9 Feb 2013 11:51:40 +0100 Subject: [PATCH] Avoided meaningless errors logging during ntfsundelete scans When ntfsundelete scans the $MFT for possible deleted files, it may examine extries which have never been used, producing error messages which most users do not understand. This patch silences such messages. --- ntfsprogs/ntfsundelete.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 7e1aa86f..cee1f2bd 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -1160,6 +1160,7 @@ static struct ufile * read_record(ntfs_volume *vol, long long record) ATTR_RECORD *attr10, *attr20, *attr90; struct ufile *file; ntfs_attr *mft; + u32 log_levels; if (!vol) return NULL; @@ -1198,6 +1199,8 @@ static struct ufile * read_record(ntfs_volume *vol, long long record) ntfs_attr_close(mft); mft = NULL; + /* disable errors logging, while examining suspicious records */ + log_levels = ntfs_log_clear_levels(NTFS_LOG_LEVEL_PERROR); attr10 = find_first_attribute(AT_STANDARD_INFORMATION, file->mft); attr20 = find_first_attribute(AT_ATTRIBUTE_LIST, file->mft); attr90 = find_first_attribute(AT_INDEX_ROOT, file->mft); @@ -1222,6 +1225,8 @@ static struct ufile * read_record(ntfs_volume *vol, long long record) if (get_data(file, vol) < 0) { ntfs_log_error("ERROR: Couldn't get data streams.\n"); } + /* restore errors logging */ + ntfs_log_set_levels(log_levels); return file; } @@ -2008,6 +2013,7 @@ static int scan_disk(ntfs_volume *vol) ntfs_log_perror("ERROR: Couldn't open $MFT/$BITMAP"); return -1; } + NVolSetNoFixupWarn(vol); bmpsize = attr->initialized_size; buffer = malloc(BUFSIZE); @@ -2094,6 +2100,7 @@ out: if (opts.match) regfree(&re); free(buffer); + NVolClearNoFixupWarn(vol); if (attr) ntfs_attr_close(attr); return results;