From: Theodore Ts'o Date: Sun, 16 Dec 2007 20:41:15 +0000 (-0500) Subject: fsck: '#' is only a comment character at the beginning of an fstab line X-Git-Tag: v1.40.4~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5221837e62641958f237e7fb5dee999cbfc850c9;p=thirdparty%2Fe2fsprogs.git fsck: '#' is only a comment character at the beginning of an fstab line Fuse and ssh fstab lines such as: wdfs#https://dav.hoster.com/foo/bar /mnt/hoster fuse user,noauto 0 0 will cause fsck to issue warnings about invalid fstab lines, because fsck was previously treating '#' as a comment when it appeared anywhere in an fstab line, not just at the beginning of the line. Addresses-Gentoo-bug: #195405 Addresses-Sourceforge-bug: #1826147 Signed-off-by: "Theodore Ts'o" --- diff --git a/misc/fsck.c b/misc/fsck.c index 108adf662..5cf1a1c85 100644 --- a/misc/fsck.c +++ b/misc/fsck.c @@ -275,20 +275,17 @@ static int parse_fstab_line(char *line, struct fs_info **ret_fs) *ret_fs = 0; strip_line(line); - if ((cp = strchr(line, '#'))) - *cp = 0; /* Ignore everything after the comment char */ cp = line; device = parse_word(&cp); + if (!device || *device == '#') + return 0; /* Ignore blank lines and comments */ mntpnt = parse_word(&cp); type = parse_word(&cp); opts = parse_word(&cp); freq = parse_word(&cp); passno = parse_word(&cp); - if (!device) - return 0; /* Allow blank lines */ - if (!mntpnt || !type) return -1;