version 1.56, 2015/10/27 15:58:42 |
version 1.57, 2015/10/28 09:51:55 |
|
|
TAILQ_INIT(&s->lastw); |
TAILQ_INIT(&s->lastw); |
RB_INIT(&s->windows); |
RB_INIT(&s->windows); |
|
|
environ_init(&s->environ); |
s->environ = environ_create(); |
if (env != NULL) |
if (env != NULL) |
environ_copy(env, &s->environ); |
environ_copy(env, s->environ); |
s->options = options_create(global_s_options); |
s->options = options_create(global_s_options); |
|
|
s->tio = NULL; |
s->tio = NULL; |
|
|
log_debug("session %s freed (%d references)", s->name, s->references); |
log_debug("session %s freed (%d references)", s->name, s->references); |
|
|
if (s->references == 0) { |
if (s->references == 0) { |
environ_free(&s->environ); |
environ_free(s->environ); |
options_free(s->options); |
options_free(s->options); |
|
|
free(s->name); |
free(s->name); |
|
|
{ |
{ |
struct window *w; |
struct window *w; |
struct winlink *wl; |
struct winlink *wl; |
struct environ env; |
struct environ *env; |
const char *shell; |
const char *shell; |
u_int hlimit; |
u_int hlimit; |
|
|
|
|
return (NULL); |
return (NULL); |
} |
} |
|
|
environ_init(&env); |
env = environ_create(); |
environ_copy(&global_environ, &env); |
environ_copy(global_environ, env); |
environ_copy(&s->environ, &env); |
environ_copy(s->environ, env); |
server_fill_environ(s, &env); |
server_fill_environ(s, env); |
|
|
shell = options_get_string(s->options, "default-shell"); |
shell = options_get_string(s->options, "default-shell"); |
if (*shell == '\0' || areshell(shell)) |
if (*shell == '\0' || areshell(shell)) |
shell = _PATH_BSHELL; |
shell = _PATH_BSHELL; |
|
|
hlimit = options_get_number(s->options, "history-limit"); |
hlimit = options_get_number(s->options, "history-limit"); |
w = window_create(name, argc, argv, path, shell, cwd, &env, s->tio, |
w = window_create(name, argc, argv, path, shell, cwd, env, s->tio, |
s->sx, s->sy, hlimit, cause); |
s->sx, s->sy, hlimit, cause); |
if (w == NULL) { |
if (w == NULL) { |
winlink_remove(&s->windows, wl); |
winlink_remove(&s->windows, wl); |
environ_free(&env); |
environ_free(env); |
return (NULL); |
return (NULL); |
} |
} |
winlink_set_window(wl, w); |
winlink_set_window(wl, w); |
notify_window_linked(s, w); |
notify_window_linked(s, w); |
environ_free(&env); |
environ_free(env); |
|
|
if (options_get_number(s->options, "set-remain-on-exit")) |
if (options_get_number(s->options, "set-remain-on-exit")) |
options_set_number(w->options, "remain-on-exit", 1); |
options_set_number(w->options, "remain-on-exit", 1); |