diff --git a/tmux.c b/tmux.c index 49fba2ba..f380b1fe 100644 --- a/tmux.c +++ b/tmux.c @@ -1,4 +1,4 @@ -/* $Id: tmux.c,v 1.218 2010-10-24 00:45:57 tcunha Exp $ */ +/* $OpenBSD: tmux.c,v 1.91 2010/10/16 08:42:35 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -214,6 +215,7 @@ shell_exec(const char *shell, const char *shellcmd) { const char *shellname, *ptr; char *argv0; + int mode; ptr = strrchr(shell, '/'); if (ptr != NULL && *(ptr + 1) != '\0') @@ -226,6 +228,12 @@ shell_exec(const char *shell, const char *shellcmd) xasprintf(&argv0, "%s", shellname); setenv("SHELL", shell, 1); + if ((mode = fcntl(STDIN_FILENO, F_GETFL)) != -1) + fcntl(STDIN_FILENO, F_SETFL, mode & ~O_NONBLOCK); + if ((mode = fcntl(STDOUT_FILENO, F_GETFL)) != -1) + fcntl(STDOUT_FILENO, F_SETFL, mode & ~O_NONBLOCK); + if ((mode = fcntl(STDERR_FILENO, F_GETFL)) != -1) + fcntl(STDERR_FILENO, F_SETFL, mode & ~O_NONBLOCK); closefrom(STDERR_FILENO + 1); execl(shell, argv0, "-c", shellcmd, (char *) NULL);