diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-12-23 21:56:39 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-12-23 21:56:39 +0000 |
commit | 6dcaa262bc27b5670726959bb425bb0d3f9c7e9d (patch) | |
tree | 8958e5f7147082f512469bd25e263ca006e4d104 /usr.bin/tmux | |
parent | fbe5b10459762b74313d861a031769ac63ff0912 (diff) |
server_kill_window can modify the RB tree so don't use RB_FOREACH, fixes
crash seen by Dan Harnett.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/server-fn.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c index 7de70c49ffc..9c810b71965 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.47 2010/12/21 22:37:59 nicm Exp $ */ +/* $OpenBSD: server-fn.c,v 1.48 2010/12/23 21:56:38 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -239,10 +239,14 @@ server_lock_client(struct client *c) void server_kill_window(struct window *w) { - struct session *s; + struct session *s, *next_s; struct winlink *wl; - RB_FOREACH(s, sessions, &sessions) { + next_s = RB_MIN(sessions, &sessions); + while (next_s != NULL) { + s = next_s; + next_s = RB_NEXT(sessions, &sessions, s); + if (session_has(s, w) == NULL) continue; while ((wl = winlink_find_by_window(&s->windows, w)) != NULL) { |