From 2142a4fd96f56e55f872a569595e310ff4062780 Mon Sep 17 00:00:00 2001 From: Colin Baumgarten Date: Mon, 18 Mar 2024 13:15:14 +0100 Subject: [PATCH] cli_dbxml(): Fix handling of mountpoints The function has code to handle mountpoints, however there is a logic error that prevents that code from ever being run. Fix that. --- apps/cli/cli_common.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/apps/cli/cli_common.c b/apps/cli/cli_common.c index 0fe4b3af..941a4dd9 100644 --- a/apps/cli/cli_common.c +++ b/apps/cli/cli_common.c @@ -425,15 +425,12 @@ cli_dbxml(clixon_handle h, if (cvec_concat_cb(argv, api_path_fmt_cb) < 0) goto done; api_path_fmt = cbuf_get(api_path_fmt_cb); - argc = cvec_len(argv); - if (cvec_len(argv) > argc){ + if (cvec_len(argv) > 0){ + argc = cvec_len(argv) - 1; cv = cvec_i(argv, argc++); str = cv_string_get(cv); - if (strncmp(str, "mtpoint:", strlen("mtpoint:")) != 0){ - clixon_err(OE_PLUGIN, 0, "mtpoint does not begin with 'mtpoint:'"); - goto done; - } - mtpoint = str + strlen("mtpoint:"); + if (str && strncmp(str, "mtpoint:", strlen("mtpoint:")) == 0) + mtpoint = str + strlen("mtpoint:"); } /* Remove all keywords */ if (cvec_exclude_keys(cvv) < 0)