Re: [hackers] [dwm][PATCH] spawn: reduce 2 lines, change fprintf() + perror() + exit() to die("... :")

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Sat, 30 Jul 2022 10:12:31 +0200

On Fri, Jul 29, 2022 at 06:26:04PM -0500, explosion0mental_AT_gmail.com wrote:
> From: explosion-mental <explosion0mental_AT_gmail.com>
>
> when calling die and the last character of the string corresponds to
> ':', die() will call perror(). See util.c
>
> Cuz muh lines of code!1
> ---
> dwm.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/dwm.c b/dwm.c
> index b3c43ee..538b8fe 100644
> --- a/dwm.c
> +++ b/dwm.c
> _AT_@ -1653,9 +1653,7 @@ spawn(const Arg *arg)
> close(ConnectionNumber(dpy));
> setsid();
> execvp(((char **)arg->v)[0], (char **)arg->v);
> - fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]);
> - perror(" failed");
> - exit(EXIT_SUCCESS);
> + die("dwm: execvp '%s' failed:", ((char **)arg->v)[0]);
> }
> }
>
> --
> 2.37.1
>
>

It's not the same, die() doesn't return EXIT_SUCCESS.

If it needs a change it needs a separate commit or comment about it.

-- 
Kind regards,
Hiltjo
Received on Sat Jul 30 2022 - 10:12:31 CEST

This archive was generated by hypermail 2.3.0 : Sat Jul 30 2022 - 10:24:35 CEST