Date: Thu, 17 Jan 2013 13:25:12 +1100 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Xin LI <delphij@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r245506 - head/bin/pwait Message-ID: <20130117130740.I1066@besplex.bde.org> In-Reply-To: <201301161815.r0GIFQPk007553@svn.freebsd.org> References: <201301161815.r0GIFQPk007553@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 16 Jan 2013, Xin LI wrote: > Log: > Use a different way to silence clang analyzer as done in r245494 by > explicitly telling the compiler that we are on the exit route. > > X-MFC: together with r245494 > > Modified: > head/bin/pwait/pwait.c > > Modified: head/bin/pwait/pwait.c > ============================================================================== > --- head/bin/pwait/pwait.c Wed Jan 16 09:07:49 2013 (r245505) > +++ head/bin/pwait/pwait.c Wed Jan 16 18:15:25 2013 (r245506) > @@ -141,6 +141,5 @@ main(int argc, char *argv[]) > nleft -= n; > } > > - free(e); > - return 0; > + exit(EX_OK); > } This uses the sysexits mistake. style(9) was fixed to not give an example of this mistake. Before this, sysexits was used a whole once in pwait(1) (for EX_USAGE) in usage(). EX_USAGE happens to be 64. As usual when the mistake is used, this is useless for humans (the usage message gives more info) and unusable for programs, especially since it is undocmented (pwait(1)'s man page just says ">0 if an error occurs". It doesn't even use '.Std' for this, but hard-codes it. The related utilities for kill(1) and pkill(1) and their man pages are better. kill(1) doesn't use the mistake, and its man page uses '.Std'. pkill(1) doesn't use the mistake; it uses small integers for exit statuses, and its man page seems to document these correctly (it cannot use .Std since the exit status isn't standard). Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130117130740.I1066>