changeset: 2423:12b204c29564
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Fri Dec 12 14:20:13 2008 -0500
files: cmd/wmii/main.c
description:
Spawn wmiirc with /dev/null on stdin
diff -r 8d8657c484bc -r 12b204c29564 cmd/wmii/main.c
--- a/cmd/wmii/main.c Thu Dec 11 13:45:05 2008 -0500
+++ b/cmd/wmii/main.c Fri Dec 12 14:20:13 2008 -0500
@@ -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,9 +292,11 @@
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);
Received on Fri Dec 12 2008 - 19:20:15 UTC
This archive was generated by hypermail 2.2.0 : Fri Dec 12 2008 - 19:24:09 UTC