From b03418fc6be38e73746a9a0d95773286d20928a9 Mon Sep 17 00:00:00 2001 From: Tiago Cunha Date: Sun, 18 Apr 2010 15:10:55 +0000 Subject: [PATCH] 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. --- server-fn.c | 10 ++++++---- 1 file 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 @@ -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;