svn commit: r208075 - in head/usr.sbin/apmd: . contrib

Bruce Evans brde at optusnet.com.au
Sun May 16 13:14:02 UTC 2010


On Fri, 14 May 2010, Ulrich Spoerlein wrote:

> Log:
>  Sync apmd(8) with DragonflyBSD, bringing WARNS to 3
>
>  Reviewed by:	ed (partial, long time ago)
> ...
> Modified: head/usr.sbin/apmd/apmd.c
> ==============================================================================
> --- head/usr.sbin/apmd/apmd.c	Fri May 14 14:26:49 2010	(r208074)
> +++ head/usr.sbin/apmd/apmd.c	Fri May 14 14:26:56 2010	(r208075)
> @@ -52,8 +52,6 @@ static const char rcsid[] =
> ...
> -		execl(_PATH_BSHELL, "sh", "-c", p->line, (char *)NULL);
> +		execl(_PATH_BSHELL, "sh", "-c", p->line, NULL);

execl() takes variadic args, so removing this cast adds a bug.

> @@ -315,7 +313,7 @@ exec_event_cmd(struct event_config *ev)
> 	status = exec_run_cmd(ev->cmdlist);
> 	if (status && ev->rejectable) {
> 		syslog(LOG_ERR, "canceled");
> -		(void) event_cmd_reject_act(NULL);
> +		event_cmd_reject_act(NULL);

Removing this cast is not as correct as removing the ones for the err()
family, since the function returns non-void.

> @@ -674,7 +672,7 @@ main(int ac, char* av[])
> 		daemon(0, 0);
>
> #ifdef NICE_INCR
> -	(void) nice(NICE_INCR);
> +	nice(NICE_INCR);
> #endif

Removing this cast is probably correct, since it is probably wrong to
not check for errors and wronger to cast away the warning (from lint)
about this.  The bug of not checking for errors remains.

Bruce


More information about the svn-src-head mailing list