summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfesowowako <118536485+fesowowako@users.noreply.github.com>2024-02-25 12:21:52 +0200
committerGitHub <noreply@github.com>2024-02-25 12:21:52 +0200
commit0c2fde57f71f0b965aafe8969da719614f53d552 (patch)
treed30c8475976c319e1831821c131537b86a72acdd
parent3b04bea45bee43347f801c30a5d5c5b5c7f83b9a (diff)
Update dwm.c
-rw-r--r--dwm.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/dwm.c b/dwm.c
index 1ce854c..3173b37 100644
--- a/dwm.c
+++ b/dwm.c
@@ -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;
}
-