From 0c2fde57f71f0b965aafe8969da719614f53d552 Mon Sep 17 00:00:00 2001 From: fesowowako <118536485+fesowowako@users.noreply.github.com> Date: Sun, 25 Feb 2024 12:21:52 +0200 Subject: Update dwm.c --- dwm.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'dwm.c') diff --git a/dwm.c b/dwm.c index 1ce854c..3173b37 100644 --- a/dwm.c +++ b/dwm.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -1954,16 +1955,12 @@ sigchld(int unused) while (0 < waitpid(-1, NULL, WNOHANG)); } +extern char **environ; + void spawn(const Arg *arg) { - if (fork() == 0) { - if (dpy) - close(ConnectionNumber(dpy)); - setsid(); - execvp(((char **)arg->v)[0], (char **)arg->v); - die("dwm: execvp '%s' failed:", ((char **)arg->v)[0]); - } + posix_spawnp(NULL, ((char **)arg->v)[0], NULL, NULL, (char **)arg->v, environ); } void @@ -2683,4 +2680,3 @@ main(int argc, char *argv[]) XCloseDisplay(dpy); return EXIT_SUCCESS; } - -- cgit v1.2.3