diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-01-29 02:22:12 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-01-29 02:22:12 +0000 |
commit | 48ff66a20c1dff60d4f09cd6e65d239f75312b8d (patch) | |
tree | a18c758f71c8ed4b315c453adb52f776d56d1b91 /usr.bin | |
parent | 117a83ff16ad7655a6f1ec67f70b8c6b568e7570 (diff) |
Call bufferevent_free before closing file descriptor associated with it
or bugs in $EventMechanism on $OtherOS makes libevent get it's knickers
in a twist. From Dylan Alex Simon.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/job.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/server-client.c | 14 | ||||
-rw-r--r-- | usr.bin/tmux/server-fn.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/window.c | 8 |
4 files changed, 16 insertions, 16 deletions
diff --git a/usr.bin/tmux/job.c b/usr.bin/tmux/job.c index 0a638be1af3..dab589e89f7 100644 --- a/usr.bin/tmux/job.c +++ b/usr.bin/tmux/job.c @@ -1,4 +1,4 @@ -/* $OpenBSD: job.c,v 1.25 2011/01/26 01:54:56 nicm Exp $ */ +/* $OpenBSD: job.c,v 1.26 2012/01/29 02:22:11 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -124,10 +124,10 @@ job_free(struct job *job) if (job->pid != -1) kill(job->pid, SIGTERM); - if (job->fd != -1) - close(job->fd); if (job->event != NULL) bufferevent_free(job->event); + if (job->fd != -1) + close(job->fd); xfree(job); } diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index 7a8a2694749..0c5dc083ff2 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.64 2012/01/21 23:51:34 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.65 2012/01/29 02:22:11 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -124,24 +124,24 @@ server_client_lost(struct client *c) if (c->flags & CLIENT_TERMINAL) tty_free(&c->tty); + if (c->stdin_event != NULL) + bufferevent_free(c->stdin_event); if (c->stdin_fd != -1) { setblocking(c->stdin_fd, 1); close(c->stdin_fd); } - if (c->stdin_event != NULL) - bufferevent_free(c->stdin_event); + if (c->stdout_event != NULL) + bufferevent_free(c->stdout_event); if (c->stdout_fd != -1) { setblocking(c->stdout_fd, 1); close(c->stdout_fd); } - if (c->stdout_event != NULL) - bufferevent_free(c->stdout_event); + if (c->stderr_event != NULL) + bufferevent_free(c->stderr_event); if (c->stderr_fd != -1) { setblocking(c->stderr_fd, 1); close(c->stderr_fd); } - if (c->stderr_event != NULL) - bufferevent_free(c->stderr_event); status_free_jobs(&c->status_new); status_free_jobs(&c->status_old); diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c index 6b7da9af474..35b18891178 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.52 2011/10/23 10:16:14 nicm Exp $ */ +/* $OpenBSD: server-fn.c,v 1.53 2012/01/29 02:22:11 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -337,8 +337,8 @@ server_destroy_pane(struct window_pane *wp) old_fd = wp->fd; if (wp->fd != -1) { - close(wp->fd); bufferevent_free(wp->event); + close(wp->fd); wp->fd = -1; } diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index bf38fd60311..66969b1889c 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.69 2011/11/15 23:19:51 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.70 2012/01/29 02:22:11 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -611,8 +611,8 @@ window_pane_destroy(struct window_pane *wp) window_pane_reset_mode(wp); if (wp->fd != -1) { - close(wp->fd); bufferevent_free(wp->event); + close(wp->fd); } input_free(wp); @@ -622,8 +622,8 @@ window_pane_destroy(struct window_pane *wp) grid_destroy(wp->saved_grid); if (wp->pipe_fd != -1) { - close(wp->pipe_fd); bufferevent_free(wp->pipe_event); + close(wp->pipe_fd); } RB_REMOVE(window_pane_tree, &all_window_panes, wp); @@ -647,8 +647,8 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell, struct termios tio2; if (wp->fd != -1) { - close(wp->fd); bufferevent_free(wp->event); + close(wp->fd); } if (cmd != NULL) { if (wp->cmd != NULL) |