commit - 70f07862e9430765dc7788416a3718ddf6e14520
commit + 1f1613cf295163e120025e06b138cda25d5e52f1
blob - eb19aa1370c1413dfea8caa409a7c5a2a46cd61c
blob + f0510ace3f8f30bc482ecdb8153e7a658f995166
--- gotd/gotd.c
+++ gotd/gotd.c
log_setverbose(verbosity);
if (proc_id == PROC_GOTD) {
- gotd.pid = getpid();
snprintf(title, sizeof(title), "%s", gotd_proc_names[proc_id]);
- start_listener(argv0, confpath, daemonize, verbosity);
arc4random_buf(&clients_hash_key, sizeof(clients_hash_key));
if (daemonize && daemon(1, 0) == -1)
fatal("daemon");
+ gotd.pid = getpid();
+ start_listener(argv0, confpath, daemonize, verbosity);
} else if (proc_id == PROC_LISTEN) {
snprintf(title, sizeof(title), "%s", gotd_proc_names[proc_id]);
if (verbosity) {
fatal("cannot listen on unix socket %s",
gotd.unix_socket_path);
}
- if (daemonize && daemon(0, 0) == -1)
- fatal("daemon");
} else if (proc_id == PROC_AUTH) {
snprintf(title, sizeof(title), "%s %s",
gotd_proc_names[proc_id], repo_path);
- if (daemonize && daemon(0, 0) == -1)
- fatal("daemon");
} else if (proc_id == PROC_REPO_READ || proc_id == PROC_REPO_WRITE ||
proc_id == PROC_SESSION) {
error = got_repo_pack_fds_open(&pack_fds);
fatalx("repository path not specified");
snprintf(title, sizeof(title), "%s %s",
gotd_proc_names[proc_id], repo_path);
- if (daemonize && daemon(0, 0) == -1)
- fatal("daemon");
} else
fatal("invalid process id %d", proc_id);