Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [day] [month] [year] [list]
Date: Wed, 12 Sep 2012 15:31:51 +0400
From: gremlin@...mlin.ru
To: owl-dev@...ts.openwall.com
Subject: e2fsprogs: skip `fsck` for root FS on installation flash

"fsck.ext2: No such file or directory while trying to open rootfs"

Patch attached.


-- 
Alexey V. Vissarionov aka Gremlin from Kremlin
<gremlin  gremlin  ru>
GPG key ID: 0xEF3B1FA8, keyserver: hkp://subkeys.pgp.net
GPG key fingerprint: 8832 FE9F A791 F796 8AC9 6E4E 909D AC45 EF3B 1FA8

diff -pruN e2fsprogs-1.41.14.orig/misc/fsck.c e2fsprogs-1.41.14/misc/fsck.c
--- e2fsprogs-1.41.14.orig/misc/fsck.c	2009-08-13 05:39:57 +0400
+++ e2fsprogs-1.41.14/misc/fsck.c	2012-09-12 15:16:41 +0400
@@ -273,6 +273,7 @@ static int parse_fstab_line(char *line,
 {
 	char	*dev, *device, *mntpnt, *type, *opts, *freq, *passno, *cp;
 	struct fs_info *fs;
+	struct stat devstat;
 
 	*ret_fs = 0;
 	strip_line(line);
@@ -297,6 +298,11 @@ static int parse_fstab_line(char *line,
 	parse_escape(freq);
 	parse_escape(passno);
 
+	if ((*device == '/')		/* if device looks like a path name */
+	&&	(stat(device,&devstat)		/* but either doesn't exist */
+		|| !S_ISBLK(devstat.st_mode)))	/* or is not a block device */
+			return 0;		/* then skip it */
+
 	dev = blkid_get_devname(cache, device, NULL);
 	if (dev)
 		device = dev;


[ CONTENT OF TYPE application/pgp-signature SKIPPED ]

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ