On 2020-09-12 10:31, Ján Tomko wrote:
On a Friday in 2020, Lin Ma wrote:
> Signed-off-by: Lin Ma <lma(a)suse.de>
> ---
> tools/virsh-domain.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index d1d3f8e566..86152a53b1 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -10458,18 +10458,21 @@ cmdDomid(vshControl *ctl, const vshCmd *cmd)
> {
> virDomainPtr dom;
> unsigned int id;
> + bool ret = false;
>
> if (!(dom = virshCommandOptDomainBy(ctl, cmd, NULL,
> VIRSH_BYNAME|VIRSH_BYUUID)))
> - return false;
> + return ret;
>
> id = virDomainGetID(dom);
> - if (id == ((unsigned int)-1))
> - vshPrint(ctl, "%s\n", "-");
> - else
> + if (id == ((unsigned int)-1)) {
> + vshError(ctl, "%s", _("Domain is not active"));
I'm not convinced we should change the existing behavior here.
Jano
ok, let's leave it as it is.
Thanks,
Lin
> + } else {
> vshPrint(ctl, "%d\n", id);
> + ret = true;
> + }
> virshDomainFree(dom);
> - return true;
> + return ret;
> }
>
> /*
> -- 2.26.0
>