version 1.108, 2013/03/22 10:31:22 |
version 1.109, 2013/03/24 09:54:10 |
|
|
int |
int |
server_start(int lockfd, char *lockfile) |
server_start(int lockfd, char *lockfile) |
{ |
{ |
int pair[2]; |
int pair[2]; |
struct timeval tv; |
struct timeval tv; |
|
char *cause; |
|
|
/* The first client is special and gets a socketpair; create it. */ |
/* The first client is special and gets a socketpair; create it. */ |
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pair) != 0) |
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pair) != 0) |
|
|
free(lockfile); |
free(lockfile); |
close(lockfd); |
close(lockfd); |
|
|
if (access(SYSTEM_CFG, R_OK) == 0) |
cfg_cmd_q = cmdq_new(NULL); |
load_cfg(SYSTEM_CFG, NULL, &cfg_causes); |
cfg_cmd_q->emptyfn = cfg_default_done; |
else if (errno != ENOENT) { |
cfg_finished = 0; |
cfg_add_cause( |
cfg_references = 1; |
&cfg_causes, "%s: %s", SYSTEM_CFG, strerror(errno)); |
ARRAY_INIT(&cfg_causes); |
} |
|
if (cfg_file != NULL) |
|
load_cfg(cfg_file, NULL, &cfg_causes); |
|
|
|
/* |
if (access(SYSTEM_CFG, R_OK) == 0) { |
* If there is a session already, put the current window and pane into |
if (load_cfg(SYSTEM_CFG, cfg_cmd_q, &cause) == -1) { |
* more mode. |
xasprintf(&cause, "%s: %s", SYSTEM_CFG, cause); |
*/ |
ARRAY_ADD(&cfg_causes, cause); |
if (!RB_EMPTY(&sessions) && !ARRAY_EMPTY(&cfg_causes)) |
} |
show_cfg_causes(RB_MIN(sessions, &sessions)); |
} else if (errno != ENOENT) { |
|
xasprintf(&cause, "%s: %s", SYSTEM_CFG, strerror(errno)); |
cfg_finished = 1; |
ARRAY_ADD(&cfg_causes, cause); |
|
} |
|
if (cfg_file != NULL) { |
|
if (load_cfg(cfg_file, cfg_cmd_q, &cause) == -1) { |
|
xasprintf(&cause, "%s: %s", cfg_file, cause); |
|
ARRAY_ADD(&cfg_causes, cause); |
|
} |
|
} |
|
cmdq_continue(cfg_cmd_q); |
|
|
server_add_accept(0); |
server_add_accept(0); |
|
|