diff options
author | fesowowako <118536485+fesowowako@users.noreply.github.com> | 2024-02-25 12:21:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-25 12:21:52 +0200 |
commit | 0c2fde57f71f0b965aafe8969da719614f53d552 (patch) | |
tree | d30c8475976c319e1831821c131537b86a72acdd | |
parent | 3b04bea45bee43347f801c30a5d5c5b5c7f83b9a (diff) |
Update dwm.c
-rw-r--r-- | dwm.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -28,6 +28,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <spawn.h> #include <sys/types.h> #include <sys/wait.h> #include <X11/cursorfont.h> @@ -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; } - |