Server/audiod option parsing improvements.
authorAndre Noll <maan@systemlinux.org>
Fri, 11 Apr 2008 17:05:07 +0000 (19:05 +0200)
committerAndre Noll <maan@systemlinux.org>
Fri, 11 Apr 2008 17:05:07 +0000 (19:05 +0200)
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
server.c

index 6935777..b880eb7 100644 (file)
--- 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;
        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();
 
        valid_fd_012();
-       audiod_cmdline_parser(argc, argv, &conf);
+       audiod_cmdline_parser_ext(argc, argv, &conf, &params);
        HANDLE_VERSION_FLAG("audiod", conf);
        para_drop_privileges(conf.user_arg, conf.group_arg);
        config_file = configfile_exists();
        if (config_file) {
        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, &params)) {
                        PARA_EMERG_LOG("parse error in config file\n");
                        exit(EXIT_FAILURE);
                if (audiod_cmdline_parser_config_file(config_file, &conf, &params)) {
                        PARA_EMERG_LOG("parse error in config file\n");
                        exit(EXIT_FAILURE);
index 90dfc1f..4765cff 100644 (file)
--- 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,
                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, &params);
                conf.daemon_given = tmp;
                };
                server_cmdline_parser_config_file(cf, &conf, &params);
                conf.daemon_given = tmp;
@@ -379,10 +380,16 @@ static unsigned server_init(int argc, char **argv)
 {
        /* connector's address information */
        int sockfd;
 {
        /* 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 */
        init_random_seed();
        /* parse command line options */
-       server_cmdline_parser(argc, argv, &conf);
+       server_cmdline_parser_ext(argc, argv, &conf, &params);
        HANDLE_VERSION_FLAG("server", conf);
        para_drop_privileges(conf.user_arg, conf.group_arg);
        /* parse config file, open log and set defaults */
        HANDLE_VERSION_FLAG("server", conf);
        para_drop_privileges(conf.user_arg, conf.group_arg);
        /* parse config file, open log and set defaults */