svn commit: r245506 - head/bin/pwait

Bruce Evans brde at optusnet.com.au
Thu Jan 17 02:25:23 UTC 2013


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


More information about the svn-src-all mailing list