commit b64f7f80ee0ce9e9defc260ec94ad183934b763e
parent 972e6adf8677a6583a8e3a1af3cae525ebc2cb3d
Author: Kris Maglione <jg@suckless.org>
Date: Fri, 12 Dec 2008 14:20:13 -0500
Spawn wmiirc with /dev/null on stdin
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/cmd/wmii/main.c b/cmd/wmii/main.c
@@ -7,6 +7,7 @@
#include <X11/Xproto.h>
#include <X11/cursorfont.h>
#include <errno.h>
+#include <fcntl.h>
#include <locale.h>
#include <pwd.h>
#include <signal.h>
@@ -291,10 +292,12 @@ spawn_command(const char *cmd) {
shell = passwd->pw_shell;
if(shell[0] != '/')
fatal("Shell is not an absolute path: %s", shell);
-
/* Run through the user's shell as a login shell */
p = smprint("-%s", strrchr(shell, '/') + 1);
+ close(0);
+ open("/dev/null", O_RDONLY);
+
execl(shell, p, "-c", cmd, nil);
fatal("Can't exec '%s': %r", cmd);
/* Not reached */