summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-04-17 23:25:17 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-04-17 23:25:17 +0000
commit7bf029de6dd52bffcc9f3bb3fb4c2e27196c740a (patch)
treec50e6f1829446e9506f17fc64d8102a8643b52c1 /usr.bin/tmux
parent93f336525d6eae2394fb01f93e59c193dc715717 (diff)
If remain-on-exit is set, both the error callback and a SIGCHLD could
destroy the same pane (because the first one doesn't remove it from the list of panes), causing the pane bufferevent to be freed twice. So don't free it if the fd has already been set to -1, from Romain Francoise.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/server-fn.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c
index 74f82af9b56..158d4e9534e 100644
--- a/usr.bin/tmux/server-fn.c
+++ b/usr.bin/tmux/server-fn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-fn.c,v 1.35 2010/03/22 19:18:46 nicm Exp $ */
+/* $OpenBSD: server-fn.c,v 1.36 2010/04/17 23:25:16 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -325,9 +325,11 @@ server_destroy_pane(struct window_pane *wp)
{
struct window *w = wp->window;
- close(wp->fd);
- bufferevent_free(wp->event);
- wp->fd = -1;
+ if (wp->fd != -1) {
+ close(wp->fd);
+ bufferevent_free(wp->event);
+ wp->fd = -1;
+ }
if (options_get_number(&w->options, "remain-on-exit"))
return;