From 880e7364a7b9e73ab2193e02ffa92af5b8647083 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Mon, 16 Aug 2004 16:46:29 +0000 Subject: - Don't exit on error reading source disk - Don't try to map sectors when no MFT loaded --- src/ntfsx.c | 16 +++++++++++++--- src/scrounge.c | 10 ++++++++-- 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ntfsx.c b/src/ntfsx.c index 60ddb66..6008e1a 100644 --- a/src/ntfsx.c +++ b/src/ntfsx.c @@ -299,7 +299,7 @@ ntfsx_attribute* ntfsx_attrib_enum_list(ntfsx_attrib_enum* attrenum, ntfsx_recor /* If we're done */ if(attrenum->_flags & ATTR_ENUM_DONELIST) return NULL; - + cluster = ntfsx_record_cluster(record); rechead = ntfsx_record_header(record); @@ -323,10 +323,17 @@ ntfsx_attribute* ntfsx_attrib_enum_list(ntfsx_attrib_enum* attrenum, ntfsx_recor attrenum->_flags |= ATTR_ENUM_DONELIST; return NULL; } + + /* We don't do attribute lists when no MFT loaded */ + if(!record->info->mftmap) + { + warnx("extended file attributes, but no MFT loaded. skipping"); + attrenum->_flags |= ATTR_ENUM_DONELIST; + return NULL; + } } /* This has to be set by now */ - ASSERT(record->info->mftmap); ASSERT(attrenum->_attrhead); ASSERT(attrenum->_attrhead->type == kNTFS_ATTRIBUTE_LIST); @@ -454,7 +461,10 @@ bool ntfsx_record_read(ntfsx_record* record, uint64 begSector, int dd) ntfs_recordheader* rechead; if(!ntfsx_cluster_read(&(record->_clus), record->info, begSector, dd)) - err(1, "couldn't read mft record from drive"); + { + warn("couldn't read mft record from drive"); + return false; + } /* Check and validate this record */ rechead = ntfsx_record_header(record); diff --git a/src/scrounge.c b/src/scrounge.c index 7dd7134..e446e58 100644 --- a/src/scrounge.c +++ b/src/scrounge.c @@ -406,7 +406,10 @@ void processMFTRecord(partitioninfo* pi, uint64 sector, uint32 flags) dataSector = CLUSTER_TO_SECTOR(*pi, (datarun->cluster + i)); if(!ntfsx_cluster_read(&cluster, pi, dataSector, pi->device)) - err(1, "couldn't read sector from disk"); + { + warn("couldn't read sector from disk"); + break; + } #ifdef _DEBUG if(g_verifyMode) @@ -635,7 +638,10 @@ void scroungeUsingRaw(partitioninfo* pi) sz = read(pi->device, buffSec, kSectorSize); if(sz == -1 || sz != kSectorSize) - errx(1, "can't read drive sector"); + { + warn("can't read drive sector"); + continue; + } /* Check beginning of sector for the magic signature */ if(!memcmp(&magic, &buffSec, sizeof(magic))) -- cgit v1.2.3