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.
edge.strict_endians
Jean-Pierre André 2013-02-09 11:51:40 +01:00
parent 61eceb2fe5
commit c972652876
1 changed files with 7 additions and 0 deletions

View File

@ -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;