diff options
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/actions.c | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index cf84ef1..8e749b5 100644 --- a/configure.ac +++ b/configure.ac @@ -165,7 +165,7 @@ AS_IF([test "$with_electric_fence" = yes], dnl Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS([pwd.h]) +AC_CHECK_HEADERS([pwd.h sys/ioctl.h]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_TYPEOF diff --git a/src/actions.c b/src/actions.c index 79db068..8917b85 100644 --- a/src/actions.c +++ b/src/actions.c @@ -34,6 +34,10 @@ #ifdef HAVE_LIBXTST # include <X11/extensions/XTest.h> #endif + +#ifdef HAVE_SYS_IOCTL_H +# include <sys/ioctl.h> +#endif #define ARG_STRING(elt) args[elt]->string @@ -2649,6 +2653,17 @@ spawn(char *cmd, int raw, rp_frame *frame) if (setsid() == -1) #endif { +#if defined (HAVE_SYS_IOCTL_H) && defined (TIOCNOTTY) + int ctty; + + ctty = open ("/dev/tty", O_RDONLY); + if (ctty != -1) + { + ioctl (ctty, TIOCNOTTY); + close (ctty); + } +#endif + #if defined (HAVE_SETPGID) setpgid (0, 0); #elif defined (HAVE_SETPGRP) |