[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: CONFIG (fsck)
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2008-07-26 23:32:39
Message-ID: 200807270132.39796.vda.linux () googlemail ! com
[Download RAW message or body]

On Friday 25 July 2008 06:20, dronnikov@gmail.com wrote:
> fsck revisited and explained.

+       while (config_read(parser, token, 6, 6, "# \t", PARSE_ESCAPE)) {

This does not allow any line with less than 6 tokens. Old code allowed
lines with 3 or more:

-       device = parse_word(&cp);
-       if (!device) return 0; /* Allow blank lines */
-       mntpnt = parse_word(&cp);
-       type = parse_word(&cp);
-       opts = parse_word(&cp);
-       /*freq =*/ parse_word(&cp);
-       passno = parse_word(&cp);
-
-       if (!mntpnt || !type)
-               return -1;



I think you'd terminally confuse code reader here. He does
not see old code, he would see only last version,
so he'll think "WTF? What NULL? There is no NULL assignments in the code!":

+/*
+       if (strchr(token[2], ','))
+               token[2] = NULL;
+       // here token[2] is NULL iff token[2] contained ',', right?
+       fs = create_fs_device(..., ...,
+               token[2] ? token[2] : "auto", // here we pass "auto" if token[2] is \
NULL, i.e. it had ',' in it, right? +                ..., ...);
+       // so we pass "auto" as type if type contained ',', right?
+*/
+
+               if (strchr(token[2], ','))
+                       token[2] = "auto";
+               fs = create_fs_device(token[0], token[1], token[2],
+                       token[3], (token[4] ? atoi(token[4]) : -1));

passno is token[5], not token[4]

--
vda
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic