- if (CLIENT_OPT_GIVEN(CONFIG_FILE, lpr))
- cf = para_strdup(CLIENT_OPT_STRING_VAL(CONFIG_FILE, lpr));
- else
- cf = make_message("%s/.paraslash/client.conf", home);
- ret = mmap_full_file(cf, O_RDONLY, &map, &sz, NULL);
- if (ret < 0) {
- if (ret != -E_EMPTY && ret != -ERRNO_TO_PARA_ERROR(ENOENT))
- goto out;
- if (ret == -ERRNO_TO_PARA_ERROR(ENOENT) &&
- CLIENT_OPT_GIVEN(CONFIG_FILE, lpr))
- goto out;
- } else {
- int cf_argc;
- char **cf_argv;
- struct lls_parse_result *cf_lpr, *merged_lpr;
- ret = lls(lls_convert_config(map, sz, NULL, &cf_argv, &errctx));
- para_munmap(map, sz);
- if (ret < 0)
- goto out;
- cf_argc = ret;
- ret = lls(lls_parse(cf_argc, cf_argv, cmd, &cf_lpr, &errctx));
- lls_free_argv(cf_argv);
- if (ret < 0)
- goto out;
- ret = lls(lls_merge(lpr, cf_lpr, cmd, &merged_lpr,
- &errctx));
- lls_free_parse_result(cf_lpr, cmd);
- if (ret < 0)
- goto out;
- lls_free_parse_result(lpr, cmd);
- lpr = merged_lpr;
- }
+ ret = lsu_merge_config_file_options(CLIENT_OPT_STRING_VAL(CONFIG_FILE, lpr),
+ "client.conf", &lpr, cmd, client_suite, 0U /* default flags */);
+ if (ret < 0)
+ goto out;