Update dwm.c

This commit is contained in:
fesowowako
2024-02-25 12:21:52 +02:00
committed by GitHub
parent 3b04bea45b
commit 0c2fde57f7
+4 -8
View File
@@ -28,6 +28,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <spawn.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <X11/cursorfont.h> #include <X11/cursorfont.h>
@@ -1954,16 +1955,12 @@ sigchld(int unused)
while (0 < waitpid(-1, NULL, WNOHANG)); while (0 < waitpid(-1, NULL, WNOHANG));
} }
extern char **environ;
void void
spawn(const Arg *arg) spawn(const Arg *arg)
{ {
if (fork() == 0) { posix_spawnp(NULL, ((char **)arg->v)[0], NULL, NULL, (char **)arg->v, environ);
if (dpy)
close(ConnectionNumber(dpy));
setsid();
execvp(((char **)arg->v)[0], (char **)arg->v);
die("dwm: execvp '%s' failed:", ((char **)arg->v)[0]);
}
} }
void void
@@ -2683,4 +2680,3 @@ main(int argc, char *argv[])
XCloseDisplay(dpy); XCloseDisplay(dpy);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }