=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/server.c,v retrieving revision 1.120 retrieving revision 1.121 diff -c -r1.120 -r1.121 *** src/usr.bin/tmux/server.c 2015/04/22 15:05:03 1.120 --- src/usr.bin/tmux/server.c 2015/04/22 15:30:11 1.121 *************** *** 1,4 **** ! /* $OpenBSD: server.c,v 1.120 2015/04/22 15:05:03 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: server.c,v 1.121 2015/04/22 15:30:11 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 137,143 **** logfile("server"); log_debug("server started, pid %ld", (long) getpid()); ! ARRAY_INIT(&windows); RB_INIT(&all_window_panes); ARRAY_INIT(&clients); ARRAY_INIT(&dead_clients); --- 137,143 ---- logfile("server"); log_debug("server started, pid %ld", (long) getpid()); ! RB_INIT(&windows); RB_INIT(&all_window_panes); ARRAY_INIT(&clients); ARRAY_INIT(&dead_clients); *************** *** 438,451 **** void server_child_exited(pid_t pid, int status) { ! struct window *w; struct window_pane *wp; struct job *job; - u_int i; ! for (i = 0; i < ARRAY_LENGTH(&windows); i++) { ! if ((w = ARRAY_ITEM(&windows, i)) == NULL) ! continue; TAILQ_FOREACH(wp, &w->panes, entry) { if (wp->pid == pid) { wp->status = status; --- 438,448 ---- void server_child_exited(pid_t pid, int status) { ! struct window *w, *w1; struct window_pane *wp; struct job *job; ! RB_FOREACH_SAFE(w, windows, &windows, w1) { TAILQ_FOREACH(wp, &w->panes, entry) { if (wp->pid == pid) { wp->status = status; *************** *** 469,482 **** { struct window *w; struct window_pane *wp; - u_int i; if (WSTOPSIG(status) == SIGTTIN || WSTOPSIG(status) == SIGTTOU) return; ! for (i = 0; i < ARRAY_LENGTH(&windows); i++) { ! if ((w = ARRAY_ITEM(&windows, i)) == NULL) ! continue; TAILQ_FOREACH(wp, &w->panes, entry) { if (wp->pid == pid) { if (killpg(pid, SIGCONT) != 0) --- 466,476 ---- { struct window *w; struct window_pane *wp; if (WSTOPSIG(status) == SIGTTIN || WSTOPSIG(status) == SIGTTOU) return; ! RB_FOREACH(w, windows, &windows) { TAILQ_FOREACH(wp, &w->panes, entry) { if (wp->pid == pid) { if (killpg(pid, SIGCONT) != 0) *************** *** 493,510 **** struct window *w; struct window_pane *wp; struct timeval tv; - u_int i; if (options_get_number(&global_s_options, "lock-server")) server_lock_server(); else server_lock_sessions(); ! for (i = 0; i < ARRAY_LENGTH(&windows); i++) { ! w = ARRAY_ITEM(&windows, i); ! if (w == NULL) ! continue; ! TAILQ_FOREACH(wp, &w->panes, entry) { if (wp->mode != NULL && wp->mode->timer != NULL) wp->mode->timer(wp); --- 487,499 ---- struct window *w; struct window_pane *wp; struct timeval tv; if (options_get_number(&global_s_options, "lock-server")) server_lock_server(); else server_lock_sessions(); ! RB_FOREACH(w, windows, &windows) { TAILQ_FOREACH(wp, &w->panes, entry) { if (wp->mode != NULL && wp->mode->timer != NULL) wp->mode->timer(wp);