Date: Sat, 17 Feb 2018 01:31:45 +1100 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Benno Rice <benno@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r329269 - head/stand/i386/boot2 Message-ID: <20180217000503.F3685@besplex.bde.org> In-Reply-To: <201802141807.w1EI7Ror036078@repo.freebsd.org> References: <201802141807.w1EI7Ror036078@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 14 Feb 2018, Benno Rice wrote: > Log: > Reformat to come significantly closer to style(9). This gives unreadable diffs. It does more than reformatting. Bugs have been reported. They must be in the non-reformatting changes. > Modified: head/stand/i386/boot2/boot2.c > ============================================================================== > --- head/stand/i386/boot2/boot2.c Wed Feb 14 18:05:37 2018 (r329268) > +++ head/stand/i386/boot2/boot2.c Wed Feb 14 18:07:27 2018 (r329269) > ... > #if SERIAL > - } else if (c == 'S') { > - j = 0; > - while ((unsigned int)(i = *arg++ - '0') <= 9) > - j = j * 10 + i; > - if (j > 0 && i == -'0') { > - comspeed = j; > - break; > - } > - /* Fall through to error below ('S' not in optstr[]). */ > + } else if (c == 'S') { > + j = 0; > + while (*arg <= '9') { > + i = (unsigned int)(*arg - '0'); > + j = j * 10 + i; > + arg++; > + } > + if (j > 0 && i == -'0') { > + comspeed = j; > + break; > + } > + /* > + * Fall through to error below > + * ('S' not in optstr[]). > + */ > #endif The bugs seem to be only here. The old code uses a bogus cast to obfuscate its classification of digits. The change breaks the classification of digits by moving the cast to a place where it has no effect. Even space separators and '\0' terminators are now misclassified as digits. Space separators seem to be broken anyway, so -S only worked if it is the last arg. Now it never works, since the terminating char is never '\0'. Moving the increment of 'arg' is risky but seems to have no effect since -S must be at the end to work so no further advance of arg is useful. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180217000503.F3685>