On Mon, Sep 06, 2010 at 11:35:17AM -0600, [email protected] wrote:
> Synopsis: <tmux crashes/receives a fatal error after being open/detached for 
> some time>
> 
> Responsible-Changed-From-To: bugs->nicm
> Responsible-Changed-By: nicm
> Responsible-Changed-When: Mon Sep 6 11:32:11 MDT 2010
> Responsible-Changed-Why: 
> This smells like the fd exhaustion bug fixed in server-client.c r1.39.

That was this change.


Index: server-client.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/server-client.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -p -r1.38 -r1.39
--- server-client.c     11 Aug 2010 07:34:43 -0000      1.38
+++ server-client.c     19 Aug 2010 17:20:26 -0000      1.39
@@ -696,17 +696,15 @@ server_client_msg_dispatch(struct client
                                fatalx("MSG_IDENTIFY missing fd");
                        memcpy(&identifydata, imsg.data, sizeof identifydata);
 
-                       c->stdin_fd = dup(imsg.fd);
-                       if (c->stdin_fd == -1)
-                               fatal("dup failed");
+                       c->stdin_fd = imsg.fd;
                        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");
 
-                       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->stdin_fd, F_GETFL)) != -1)
+                               fcntl(c->stdin_fd, F_SETFL, mode|O_NONBLOCK);
+                       if (fcntl(c->stdin_fd, F_SETFD, FD_CLOEXEC) == -1)
                                fatal("fcntl failed");
 
                        server_client_msg_identify(c, &identifydata, imsg.fd);

Reply via email to