Index | Thread | Search

From:
Klemens Nanni <kn@openbsd.org>
Subject:
Re: watch(1): get rid of sysexits.h; 1 should be good enough for every error.
To:
tech <tech@openbsd.org>
Date:
Tue, 20 May 2025 12:26:13 +0000

Download raw body.

Thread
20.05.2025 15:12, Florian Obser пишет:
> OK?

sure

> @@ -408,10 +407,10 @@ read_result(BUFFER *buf)
>  	memset(buf, 0, sizeof(*buf));
>  
>  	if (pipe(fds) == -1)
> -		err(EX_OSERR, "pipe()");
> +		err(1, "pipe()");

You could get rid of all those parantheses while there, base usually prints
the function name without them.

>  
>  	if ((pipe_pid = vfork()) == -1)
> -		err(EX_OSERR, "vfork()");
> +		err(1, "vfork()");
>  	else if (pipe_pid == 0) {
>  		close(fds[0]);
>  		if (fds[1] != STDOUT_FILENO) {
> @@ -425,12 +424,12 @@ read_result(BUFFER *buf)
>  
>  		/* use warn(3) + _exit(2) not to call exit(3) */
>  		warn("exec(%s)", cmdstr);
> -		_exit(EX_OSERR);
> +		_exit(1);
>  
>  		/* NOTREACHED */
>  	}
>  	if ((fp = fdopen(fds[0], "r")) == NULL)
> -		err(EX_OSERR, "fdopen()");
> +		err(1, "fdopen()");
>  	close(fds[1]);
>  
>  	/* Read command output and convert tab to spaces * */
>