On Fri, May 27, 2016 at 11:05:30PM -0300, Gleydson Soares wrote:
>
> Ted Unangst <[email protected]> writes:
>
> > [email protected] wrote:
> >> Brace belongs to switch statement, not while loop
> >>
> >> RCS file: /cvs/src/usr.bin/lock/lock.c,v
> >> retrieving revision 1.32
> >> diff -u -p -r1.32 lock.c
> >> --- lock.c 15 Oct 2015 02:35:04 -0000 1.32
> >> +++ lock.c 27 May 2016 21:41:15 -0000
> >> @@ -134,7 +134,7 @@ main(int argc, char *argv[])
> >> "usage: %s [-np] [-a style] [-t timeout]\n",
> >> __progname);
> >> exit(1);
> >> - }
> >> + }
> >> timeout.tv_sec = sectimeout * 60;
> >>
> >> gethostname(hostname, sizeof(hostname));
> >
> > I think these problems are best fixed by adding braces in both places.
> > That's
> > a very large while() to leave a bare statement dangling off it.
>
> Index: lock.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/lock/lock.c,v
> retrieving revision 1.32
> diff -u -p -r1.32 lock.c
> --- lock.c 15 Oct 2015 02:35:04 -0000 1.32
> +++ lock.c 28 May 2016 01:45:56 -0000
> @@ -106,7 +106,7 @@ main(int argc, char *argv[])
> backoff = (int)login_getcapnum(lc, "login-backoff", 3, 3);
> }
>
> - while ((ch = getopt(argc, argv, "a:npt:")) != -1)
> + while ((ch = getopt(argc, argv, "a:npt:")) != -1) {
> switch (ch) {
> case 'a':
> if (lc) {
> @@ -134,6 +134,7 @@ main(int argc, char *argv[])
> "usage: %s [-np] [-a style] [-t timeout]\n",
> __progname);
> exit(1);
> + }
> }
> timeout.tv_sec = sectimeout * 60;
>
ok natano@