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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to