Update of /cvsroot/tmux/tmux
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv2690

Modified Files:
        tmux.c 
Log Message:
Sync OpenBSD patchset 776:

Make stdio blocking again before calling shell command with -c.


Index: tmux.c
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.c,v
retrieving revision 1.218
retrieving revision 1.219
diff -u -d -r1.218 -r1.219
--- tmux.c      24 Oct 2010 00:45:57 -0000      1.218
+++ tmux.c      24 Oct 2010 00:47:46 -0000      1.219
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $OpenBSD: tmux.c,v 1.91 2010/10/16 08:42:35 nicm Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -22,6 +22,7 @@
 
 #include <errno.h>
 #include <event.h>
+#include <fcntl.h>
 #include <pwd.h>
 #include <signal.h>
 #include <stdlib.h>
@@ -214,6 +215,7 @@
 {
        const char      *shellname, *ptr;
        char            *argv0;
+       int              mode;
 
        ptr = strrchr(shell, '/');
        if (ptr != NULL && *(ptr + 1) != '\0')
@@ -226,6 +228,12 @@
                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);


------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to