daemon_open_log_or_die();
}
- daemon_init_colors_or_die(conf.color_arg, color_arg_auto, color_arg_no,
- conf.logfile_given, conf.log_color_arg, conf.log_color_given);
+ if (daemon_init_colors_or_die(conf.color_arg, color_arg_auto, color_arg_no,
+ conf.logfile_given)) {
+ int i;
+ for (i = 0; i < conf.log_color_given; i++)
+ daemon_set_log_color_or_die(conf.log_color_arg[i]);
+ }
daemon_set_flag(DF_LOG_PID);
daemon_set_flag(DF_LOG_LL);
daemon_set_flag(DF_LOG_TIME);
.check_ambiguity = 0,
.print_errors = 1
};
- int afs_socket;
+ int afs_socket, daemon_pipe = -1;
valid_fd_012();
init_random_seed_or_die();
init_user_list(user_list_file);
/* become daemon */
if (conf.daemon_given)
- daemonize(true /* parent waits for SIGTERM */);
+ daemon_pipe = daemonize(true /* parent waits for us */);
PARA_NOTICE_LOG("initializing audio format handlers\n");
afh_init();
PARA_NOTICE_LOG("initializing virtual streaming system\n");
init_vss_task(afs_socket, &sched);
init_server_command_task(argc, argv);
- if (conf.daemon_given)
- kill(getppid(), SIGTERM);
+ if (daemon_pipe >= 0) {
+ if (write(daemon_pipe, "\0", 1) < 0) {
+ PARA_EMERG_LOG("daemon_pipe: %s", strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ close(daemon_pipe);
+ }
PARA_NOTICE_LOG("server init complete\n");
}