aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-04-17 23:25:16 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-04-17 23:25:16 +0000
commita6d52405a8eea89d803a95843687c49f9115ca65 (patch)
tree35f2d687f5d06640a5c975de11488d91cc400428
parent842bc2b855114984c6c182b83523d7268b8b2b0b (diff)
downloadrtmux-a6d52405a8eea89d803a95843687c49f9115ca65.tar.gz
rtmux-a6d52405a8eea89d803a95843687c49f9115ca65.tar.bz2
rtmux-a6d52405a8eea89d803a95843687c49f9115ca65.zip
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.
-rw-r--r--server-fn.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/server-fn.c b/server-fn.c
index 86d7ffdd..01e78ba2 100644
--- a/server-fn.c
+++ b/server-fn.c
@@ -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;