=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/window.c,v retrieving revision 1.202 retrieving revision 1.203 diff -c -r1.202 -r1.203 *** src/usr.bin/tmux/window.c 2017/07/12 09:24:17 1.202 --- src/usr.bin/tmux/window.c 2017/07/12 10:04:51 1.203 *************** *** 1,4 **** ! /* $OpenBSD: window.c,v 1.202 2017/07/12 09:24:17 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: window.c,v 1.203 2017/07/12 10:04:51 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 22,27 **** --- 22,28 ---- #include #include #include + #include #include #include #include *************** *** 886,891 **** --- 887,893 ---- const char *ptr, *first, *home; struct termios tio2; int i; + sigset_t set, oldset; if (wp->fd != -1) { bufferevent_free(wp->event); *************** *** 915,928 **** ws.ws_col = screen_size_x(&wp->base); ws.ws_row = screen_size_y(&wp->base); ! wp->pid = fdforkpty(ptm_fd, &wp->fd, wp->tty, NULL, &ws); ! switch (wp->pid) { case -1: wp->fd = -1; xasprintf(cause, "%s: %s", cmd, strerror(errno)); free(cmd); return (-1); case 0: if (chdir(wp->cwd) != 0) { if ((home = find_home()) == NULL || chdir(home) != 0) chdir("/"); --- 917,937 ---- ws.ws_col = screen_size_x(&wp->base); ws.ws_row = screen_size_y(&wp->base); ! sigfillset(&set); ! sigprocmask(SIG_BLOCK, &set, &oldset); ! switch (wp->pid = fdforkpty(ptm_fd, &wp->fd, wp->tty, NULL, &ws)) { case -1: wp->fd = -1; + xasprintf(cause, "%s: %s", cmd, strerror(errno)); free(cmd); + + sigprocmask(SIG_SETMASK, &oldset, NULL); return (-1); case 0: + proc_clear_signals(server_proc); + sigprocmask(SIG_SETMASK, &oldset, NULL); + if (chdir(wp->cwd) != 0) { if ((home = find_home()) == NULL || chdir(home) != 0) chdir("/"); *************** *** 936,941 **** --- 945,951 ---- if (tcsetattr(STDIN_FILENO, TCSANOW, &tio2) != 0) fatal("tcgetattr failed"); + log_close(); closefrom(STDERR_FILENO + 1); if (path != NULL) *************** *** 943,951 **** environ_set(env, "TMUX_PANE", "%%%u", wp->id); environ_push(env); - proc_clear_signals(server_proc); - log_close(); - setenv("SHELL", wp->shell, 1); ptr = strrchr(wp->shell, '/'); --- 953,958 ---- *************** *** 978,983 **** --- 985,991 ---- fatal("execl failed"); } + sigprocmask(SIG_SETMASK, &oldset, NULL); setblocking(wp->fd, 0); wp->event = bufferevent_new(wp->fd, window_pane_read_callback, NULL,