Changes by: antona
Update of /cvsroot/linux-ntfs/linux-ntfs/ntfstools
In directory usw-pr-cvs1:/tmp/cvs-serv3652/ntfstools
Modified Files:
ntfsdump_logfile.c ntfsfix.c ntfslabel.c
Log Message:
Change ntfs_read_file_record() not to abort if the inode is not in use. Adapt callers which care to check this themselves.
Index: ntfsdump_logfile.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/ntfsdump_logfile.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -U2 -r1.24 -r1.25
--- ntfsdump_logfile.c 3 Jul 2002 21:56:01 -0000 1.24
+++ ntfsdump_logfile.c 7 Jul 2002 19:44:57 -0000 1.25
@@ -74,5 +74,4 @@
int pass = 1;
int i, lps, client;
- MFT_REF mref;
char zero[4096];
@@ -122,7 +121,11 @@
}
/* Read in $LogFile. */
- mref = (MFT_REF)FILE_LogFile;
- if (ntfs_read_file_record(vol, mref, &m, NULL)) {
+ if (ntfs_read_file_record(vol, FILE_LogFile, &m, NULL)) {
fprintf(stderr, "Error reading mft record for $LogFile.\n");
+ goto error_exit;
+ }
+ if (!(m->flags & MFT_RECORD_IN_USE)) {
+ fprintf(stderr, "Error: $LogFile has been deleted. Run chkdsk "
+ "to fix this.\n");
goto error_exit;
}
Index: ntfsfix.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/ntfsfix.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -U2 -r1.35 -r1.36
--- ntfsfix.c 3 Jul 2002 21:56:01 -0000 1.35
+++ ntfsfix.c 7 Jul 2002 19:44:57 -0000 1.36
@@ -261,4 +261,9 @@
goto error_exit;
}
+ if (!(((MFT_RECORD*)m)->flags & MFT_RECORD_IN_USE)) {
+ fprintf(stderr, "Error: $Volume has been deleted. Cannot "
+ "handle this yet. Run chkdsk to fix this.\n");
+ goto error_exit;
+ }
/* Check NTFS version is ok for us (in $Volume) */
@@ -315,4 +320,9 @@
if (ntfs_read_file_record(vol, FILE_LogFile, (MFT_RECORD**)&m, NULL)) {
perror("Failed to read $LogFile");
+ goto error_exit;
+ }
+ if (!(((MFT_RECORD*)m)->flags & MFT_RECORD_IN_USE)) {
+ fprintf(stderr, "Error: $LogFile has been deleted. Cannot "
+ "handle this yet. Run chkdsk to fix this.\n");
goto error_exit;
}
Index: ntfslabel.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/ntfslabel.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -U2 -r1.14 -r1.15
--- ntfslabel.c 2 Jul 2002 23:47:11 -0000 1.14
+++ ntfslabel.c 7 Jul 2002 19:44:57 -0000 1.15
@@ -152,4 +152,9 @@
goto err_out;
}
+ if (!(mrec->flags & MFT_RECORD_IN_USE)) {
+ fprintf(stderr, "Error: $Volume has been deleted. Run "
+ "chkdsk to fix this.\n");
+ goto err_out;
+ }
ctx = ntfs_get_attr_search_ctx(NULL, mrec);
if (!ctx) {
@@ -193,4 +198,6 @@
if (new_label)
free(new_label);
+ if (mrec)
+ free(mrec);
if (ntfs_umount(vol, 0))
ntfs_umount(vol, 1);
|