From d248e3dca83f1fc51599e02b827f35bc21fcaeb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Wed, 26 Jan 2022 13:25:44 +0100 Subject: [PATCH] virsh: domsetlaunchsecstate: report error if no options are passed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We already exit if they are not present. Report an error, but do not mark them as required in case a future version of this command will want to accept a different set of parameters. https://bugzilla.redhat.com/show_bug.cgi?id=2046024 Signed-off-by: Ján Tomko Reviewed-by: Michal Privoznik --- tools/virsh-domain.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index b56f6a90f5..43d310f2af 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -9627,8 +9627,10 @@ cmdDomSetLaunchSecState(vshControl * ctl, const vshCmd * cmd) if (vshCommandOptStringReq(ctl, cmd, "secret", &secfile) < 0) return false; - if (sechdrfile == NULL || secfile == NULL) + if (sechdrfile == NULL || secfile == NULL) { + vshError(ctl, "%s", _("Both secret and the secret header are required")); return false; + } if (virFileReadAll(sechdrfile, 1024*64, &sechdr) < 0) { vshSaveLibvirtError();