WindowMaker/WindowMaker-exec.patch

63 lines
1.3 KiB
Diff

--- src/dock.c
+++ src/dock.c
@@ -3002,6 +3002,8 @@
args[i] = argv[i];
}
args[argc] = NULL;
+ for(i = 3; i < 1024; i++)
+ close(i);
execvp(argv[0], args);
exit(111);
}
--- src/main.c
+++ src/main.c
@@ -302,12 +302,16 @@
pid = fork();
if (pid==0) {
+ int i;
SetupEnvironment(scr);
#ifdef HAVE_SETSID
setsid();
#endif
+ for(i = 3; i < 1024; i++)
+ close(i);
+
execl(shell, shell, "-c", command, NULL);
wsyserror("could not execute %s -c %s", shell, command);
Exit(-1);
@@ -337,6 +341,7 @@
int in_fd[2];
int out_fd[2];
int err_fd[2];
+ int i;
pid_t pid;
SetupEnvironment(scr);
@@ -389,7 +394,9 @@
close(in_fd[1]);
close(out_fd[1]);
close(err_fd[1]);
-
+
+ for(i = 3; i < 1024; i++)
+ close(i);
execl("/bin/sh", "/bin/sh", "-c", wPreferences.logger_shell, NULL);
wsyserror("could not execute %s\n", wPreferences.logger_shell);
exit(1);
--- src/session.c
+++ src/session.c
@@ -398,6 +398,10 @@
args[i] = argv[i];
}
args[argc] = NULL;
+
+ for(i = 3; i < 1024; i++)
+ close(i);
+
execvp(argv[0], args);
exit(111);
}