From 353e26aabd3849379ee960874d2219d36cc4d62f Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 11 Apr 2008 19:05:07 +0200 Subject: [PATCH 1/1] Server/audiod option parsing improvements. Do not refuse to start if -L is given in config file and -d at the command line. Without this patch, para_server and para_audiod would error out complaining about -d requiring -L without even looking at the config file. --- audiod.c | 21 +++++++++++++-------- server.c | 15 +++++++++++---- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/audiod.c b/audiod.c index 69357779..b880eb7f 100644 --- a/audiod.c +++ b/audiod.c @@ -1033,20 +1033,25 @@ int main(int argc, char *argv[]) int ret, i; struct sched s; struct command_task command_task_struct, *cmd_task = &command_task_struct; + struct audiod_cmdline_parser_params params = { + .override = 0, + .initialize = 1, + .check_required = 0, + .check_ambiguity = 0, + .print_errors = 1 + }; valid_fd_012(); - audiod_cmdline_parser(argc, argv, &conf); + audiod_cmdline_parser_ext(argc, argv, &conf, ¶ms); HANDLE_VERSION_FLAG("audiod", conf); para_drop_privileges(conf.user_arg, conf.group_arg); config_file = configfile_exists(); if (config_file) { - struct audiod_cmdline_parser_params params = { - .override = 0, - .initialize = 0, - .check_required = 0, - .check_ambiguity = 0 - - }; + params.override = 0; + params.initialize = 0; + params.check_required = 1; + params.check_ambiguity = 0; + params.print_errors = 1; if (audiod_cmdline_parser_config_file(config_file, &conf, ¶ms)) { PARA_EMERG_LOG("parse error in config file\n"); exit(EXIT_FAILURE); diff --git a/server.c b/server.c index 90dfc1f5..4765cff4 100644 --- a/server.c +++ b/server.c @@ -257,8 +257,9 @@ static void parse_config(int override) struct server_cmdline_parser_params params = { .override = override, .initialize = 0, - .check_required = 0, - .check_ambiguity = 0 + .check_required = 1, + .check_ambiguity = 0, + .print_errors = 1 }; server_cmdline_parser_config_file(cf, &conf, ¶ms); conf.daemon_given = tmp; @@ -379,10 +380,16 @@ static unsigned server_init(int argc, char **argv) { /* connector's address information */ int sockfd; - + struct server_cmdline_parser_params params = { + .override = 0, + .initialize = 1, + .check_required = 0, + .check_ambiguity = 0, + .print_errors = 1 + }; init_random_seed(); /* parse command line options */ - server_cmdline_parser(argc, argv, &conf); + server_cmdline_parser_ext(argc, argv, &conf, ¶ms); HANDLE_VERSION_FLAG("server", conf); para_drop_privileges(conf.user_arg, conf.group_arg); /* parse config file, open log and set defaults */ -- 2.39.2