Skip to contentSkip to conversation

fix e2fsck error checking

PATCH In review Jeff Moyer 2 participants 2 messages Nov 9, 2006 Kernel automounter

lore
Share & tools
lore

Jeff Moyer

author
#0 lore raw

PATCH 1/1 fix e2fsck error checking

Hi, Ian, list,

The patch is pretty self-explanatory. Comments are welcome, as always. I sent this a while back, too. I have not re-tested it since then.

-Jeff

modules/mount_ext2.c +7 -1
index b2efb96..a7f008f 100644
@@ -99,7 +99,13 @@ #endif
 		err = spawnl(LOG_DEBUG, fsck_prog, fsck_prog, "-p", what, NULL);
 	}
 
-	if (err & ~6) {
+	/*
+	 * spawnl returns the error code, left shifted by 8 bits.  We are
+	 * interested in the following error bits from the fsck program:
+	 *    2 - File system errors corrected, system should be rebooted
+	 *    4 - File system errors left uncorrected
+	 */
+	if ((err >> 8) & 6) {
 		error(MODPREFIX "%s: filesystem needs repair, won't mount",
 		      what);
 		return 1;
maintainer
#1 lore raw
Quoted 13 lines · Jeff Moyer

Hi, Ian, list,

The patch is pretty self-explanatory. Comments are welcome, as always. I sent this a while back, too. I have not re-tested it since then.

(quoted diff) +0 -1
-Jeff
modules/mount_ext2.c +0 -0
index b2efb96..a7f008f 100644

modules/mount_ext2.c #endif · line 103

Quoted 6 lines
modules/mount_ext2.c +2 -1
@@ -99,7 +99,13 @@ #endif
 		err = spawnl(LOG_DEBUG, fsck_prog, fsck_prog, "-p", what, NULL);
 	}
 
-	if (err & ~6) {
+	/*
+	 * spawnl returns the error code, left shifted by 8 bits.  We are

I thought I checked this and concluded it wasn't actually the case. I'll check it again.

Quoted 8 lines
modules/mount_ext2.c +5 -0
+	 * interested in the following error bits from the fsck program:
+	 *    2 - File system errors corrected, system should be rebooted
+	 *    4 - File system errors left uncorrected
+	 */
+	if ((err >> 8) & 6) {
 		error(MODPREFIX "%s: filesystem needs repair, won't mount",
 		      what);
 		return 1;