summaryrefslogtreecommitdiff
path: root/e2fsck/pass1.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>1997-08-14 17:17:16 +0000
committerTheodore Ts'o <tytso@mit.edu>1997-08-14 17:17:16 +0000
commit7cf73dcd3d173d88ceab26d381f4abac362d8518 (patch)
treec02a37e48c91366a425d2475415084fb3663627a /e2fsck/pass1.c
parent3cb6c5021d722e17b7105d1bc090880671f6fc6d (diff)
downloade2fsprogs-7cf73dcd3d173d88ceab26d381f4abac362d8518.tar.gz
ChangeLog, e2fsck.h, message.c, pass1.c, pass2.c, problem.c, problem.h:
message.c: Add compression for the word "Illegal" problem.c: Added entries for PR_2_BAD_CHAR_DEV and PR_2_BAD_BLOCK_DEV pass1.c (pass1, check_device_inode), pass2.c (process_bad_inode): Use a more stringent test for a valid device. ChangeLog, Makefile.in: Makefile.in (install): Fix rm command to use $(DESTDIR) appropriately.
Diffstat (limited to 'e2fsck/pass1.c')
-rw-r--r--e2fsck/pass1.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 1e837597..2f1d67e7 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -166,6 +166,20 @@ static void unwind_pass1(ext2_filsys fs)
fs_fragmented = 0;
}
+/*
+ * Check to make sure a device inode is real. Returns 1 if the device
+ * checks out, 0 if not.
+ */
+int e2fsck_pass1_check_device_inode(struct ext2_inode *inode)
+{
+ int i;
+
+ for (i=4; i < EXT2_N_BLOCKS; i++)
+ if (inode->i_block[i])
+ return 0;
+ return 1;
+}
+
void pass1(ext2_filsys fs)
{
ino_t ino;
@@ -402,9 +416,11 @@ void pass1(ext2_filsys fs)
fs_directory_count++;
} else if (LINUX_S_ISREG (inode.i_mode))
fs_regular_count++;
- else if (LINUX_S_ISCHR (inode.i_mode))
+ else if (LINUX_S_ISCHR (inode.i_mode) &&
+ e2fsck_pass1_check_device_inode(&inode))
fs_chardev_count++;
- else if (LINUX_S_ISBLK (inode.i_mode))
+ else if (LINUX_S_ISBLK (inode.i_mode) &&
+ e2fsck_pass1_check_device_inode(&inode))
fs_blockdev_count++;
else if (LINUX_S_ISLNK (inode.i_mode)) {
fs_symlinks_count++;