svn commit: r216422 - head/usr.bin/printf

Jilles Tjoelker jilles at stack.nl
Tue Dec 14 18:09:59 UTC 2010


On Tue, Dec 14, 2010 at 12:21:35AM +0000, Xin LI wrote:
> Author: delphij
> Date: Tue Dec 14 00:21:34 2010
> New Revision: 216422
> URL: http://svn.freebsd.org/changeset/base/216422

> Log:
>   Make use of EX_USAGE for usage().

> Modified:
>   head/usr.bin/printf/printf.c

> Modified: head/usr.bin/printf/printf.c
> ==============================================================================
> --- head/usr.bin/printf/printf.c	Mon Dec 13 23:53:55 2010	(r216421)
> +++ head/usr.bin/printf/printf.c	Tue Dec 14 00:21:34 2010	(r216422)
[...]
> +	exit(EX_USAGE);
>  }

This does not work properly when printf is an sh builtin. The exit()
call causes sh to exit entirely, rather than the builtin to return to
the shell. The bug can be noticed easily because the test
errors/option-error.0 (from tools/regression/bin/sh) fails.

Please revert to returning the exit status from main(). Although I plan
to clean up usr.bin/printf slightly after the n$ stuff is committed, I
do not plan on adding things to sh that will allow exit() emulation in
builtins.

Other people have already said things about <sysexits.h>.

-- 
Jilles Tjoelker


More information about the svn-src-head mailing list