Skip to contentSkip to conversation

fix e2fsck error code check

PATCH New Jeff Moyer 1 participant 1 message May 17, 2006 Kernel automounter

lore
Share & tools
lore

Jeff Moyer

author
#0 lore raw

PATCH 1/1 fix e2fsck error code check

Hi, Ian,

The patch is pretty self-explanatory. Comments are welcome, as always.

-Jeff

modules/mount_ext2.c renamed from modules/mount_ext2.c.orig +7 -1
@@ -98,7 +98,13 @@ int mount_mount(const char *root, const 
 		err = spawnl(LOG_DEBUG, MOUNTED_LOCK, 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;