- ret = check_config();
- if (ret < 0)
- goto out;
- if (override) {
- /* don't change daemon mode on SIGHUP */
- conf.daemon_given = old_daemon_given;
- close_log(logfile);
- logfile = NULL;
- if (conf.logfile_given)
- free(old_logfile_arg);
- else if (conf.daemon_given) { /* re-use old logfile */
- conf.logfile_arg = old_logfile_arg;
- conf.logfile_given = 1;
- }
+ map = mmap(NULL, sz, PROT_READ, MAP_PRIVATE, fd, 0);
+ if (map == MAP_FAILED) {
+ ret = -ERRNO_TO_DSS_ERROR(errno);
+ DSS_ERROR_LOG(("failed to mmap config file %s\n",
+ config_file));
+ goto close_fd;
+ }
+ if (cmd == CMD_PTR(DSS))
+ subcmd_name = NULL;
+ else
+ subcmd_name = lls_command_name(cmd);
+ ret = lls_convert_config(map, sz, subcmd_name, &cf_argv, &errctx);
+ munmap(map, sz);
+ if (ret < 0) {
+ DSS_ERROR_LOG(("failed to convert config file %s\n",
+ config_file));
+ ret = lopsub_error(ret, &errctx);
+ goto close_fd;
+ }
+ cf_argc = ret;
+ ret = lls_parse(cf_argc, cf_argv, cmd, &cf_lpr, &errctx);
+ lls_free_argv(cf_argv);
+ if (ret < 0) {
+ ret = lopsub_error(ret, &errctx);
+ goto close_fd;
+ }
+ clpr = cmd == CMD_PTR(DSS)? cmdline_lpr : cmdline_sublpr;
+ if (sighup) /* config file overrides command line */
+ ret = lls_merge(cf_lpr, clpr, cmd, &merged_lpr, &errctx);
+ else /* command line options overrride config file options */
+ ret = lls_merge(clpr, cf_lpr, cmd, &merged_lpr, &errctx);
+ lls_free_parse_result(cf_lpr, cmd);
+ if (ret < 0) {
+ ret = lopsub_error(ret, &errctx);
+ goto close_fd;