CONFIG (fsck)

Denys Vlasenko vda.linux at googlemail.com
Sat Jul 26 23:32:39 UTC 2008


On Friday 25 July 2008 06:20, dronnikov at 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



More information about the busybox mailing list