if (ll < conf.loglevel_arg)
return;
- if (!logfile && conf.logfile_given)
- logfile = open_log(conf.logfile_arg);
- if (!logfile && conf.daemon_given)
- return;
- if (!logfile) {
- if (ll < WARNING)
- outfd = stdout;
- else
- outfd = stderr;
- } else
- outfd = logfile;
+ outfd = logfile? logfile : stderr;
time(&t1);
tm = localtime(&t1);
strftime(str, MAXLINE, "%b %d %H:%M:%S", tm);
valid_fd_012();
hostname = para_hostname();
cmdline_parser(argc, argv, &conf);
- para_drop_privileges(conf.user_arg);
+ para_drop_privileges(conf.user_arg, conf.group_arg);
cf = configfile_exists();
if (cf) {
if (cmdline_parser_configfile(cf, &conf, 0, 0, 0)) {
- fprintf(stderr, "parse error in config file\n");
+ PARA_EMERG_LOG("%s", "parse error in config file\n");
exit(EXIT_FAILURE);
}
}
+ if (conf.logfile_given)
+ logfile = open_log(conf.logfile_arg);
log_welcome("para_audiod", conf.loglevel_arg);
i = init_stream_io();
if (i < 0) {
- fprintf(stderr, "init stream io error: %s\n",
- PARA_STRERROR(-i));
+ PARA_EMERG_LOG("init stream io error: %s\n", PARA_STRERROR(-i));
exit(EXIT_FAILURE);
}
server_uptime(UPTIME_SET);