diff options
author | Tiago Cunha <tcunha@gmx.com> | 2010-04-18 15:10:55 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2010-04-18 15:10:55 +0000 |
commit | b03418fc6be38e73746a9a0d95773286d20928a9 (patch) | |
tree | e8e185dd0250abbad93fce05ca67a39cc0755d1d /server-fn.c | |
parent | c0f03afbac2392c005f302e13f10546bf30505df (diff) |
Sync OpenBSD patchset 682:
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 'server-fn.c')
-rw-r--r-- | server-fn.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/server-fn.c b/server-fn.c index d141f982..63280bd8 100644 --- a/server-fn.c +++ b/server-fn.c @@ -1,4 +1,4 @@ -/* $Id: server-fn.c,v 1.104 2010-04-06 21:45:36 nicm Exp $ */ +/* $Id: server-fn.c,v 1.105 2010-04-18 15:10:55 tcunha 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; |