Update of /cvsroot/tmux/tmux
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv31433
Modified Files:
server-client.c
Log Message:
Sync OpenBSD patchset 742:
dup() the stdin fd so it isn't closed twice (once for stdin, once for tty).
Index: server-client.c
===================================================================
RCS file: /cvsroot/tmux/tmux/server-client.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- server-client.c 9 Aug 2010 21:44:25 -0000 1.37
+++ server-client.c 9 Aug 2010 21:45:37 -0000 1.38
@@ -647,9 +647,11 @@
fatalx("MSG_IDENTIFY missing fd");
memcpy(&identifydata, imsg.data, sizeof identifydata);
- c->stdin_fd = imsg.fd;
- c->stdin_event = bufferevent_new(imsg.fd, NULL, NULL,
- server_client_in_callback, c);
+ c->stdin_fd = dup(imsg.fd);
+ if (c->stdin_fd == -1)
+ fatal("dup failed");
+ c->stdin_event = bufferevent_new(c->stdin_fd,
+ NULL, NULL, server_client_in_callback, c);
if (c->stdin_event == NULL)
fatalx("failed to create stdin event");
@@ -667,14 +669,14 @@
fatalx("MSG_STDOUT missing fd");
c->stdout_fd = imsg.fd;
- c->stdout_event = bufferevent_new(imsg.fd, NULL, NULL,
- server_client_out_callback, c);
+ c->stdout_event = bufferevent_new(c->stdout_fd,
+ NULL, NULL, server_client_out_callback, c);
if (c->stdout_event == NULL)
fatalx("failed to create stdout event");
- if ((mode = fcntl(imsg.fd, F_GETFL)) != -1)
- fcntl(imsg.fd, F_SETFL, mode|O_NONBLOCK);
- if (fcntl(imsg.fd, F_SETFD, FD_CLOEXEC) == -1)
+ if ((mode = fcntl(c->stdout_fd, F_GETFL)) != -1)
+ fcntl(c->stdout_fd, F_SETFL, mode|O_NONBLOCK);
+ if (fcntl(c->stdout_fd, F_SETFD, FD_CLOEXEC) == -1)
fatal("fcntl failed");
break;
case MSG_STDERR:
@@ -684,14 +686,14 @@
fatalx("MSG_STDERR missing fd");
c->stderr_fd = imsg.fd;
- c->stderr_event = bufferevent_new(imsg.fd, NULL, NULL,
- server_client_err_callback, c);
+ c->stderr_event = bufferevent_new(c->stderr_fd,
+ NULL, NULL, server_client_err_callback, c);
if (c->stderr_event == NULL)
fatalx("failed to create stderr event");
- if ((mode = fcntl(imsg.fd, F_GETFL)) != -1)
- fcntl(imsg.fd, F_SETFL, mode|O_NONBLOCK);
- if (fcntl(imsg.fd, F_SETFD, FD_CLOEXEC) == -1)
+ if ((mode = fcntl(c->stderr_fd, F_GETFL)) != -1)
+ fcntl(c->stderr_fd, F_SETFL, mode|O_NONBLOCK);
+ if (fcntl(c->stderr_fd, F_SETFD, FD_CLOEXEC) == -1)
fatal("fcntl failed");
break;
case MSG_RESIZE:
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs