From: Jiri Denemark Date: Thu, 20 Feb 2025 13:41:32 +0000 (+0100) Subject: virsh: Let prohibit_newline_at_end_of_diagnostic check pass X-Git-Tag: v11.1.0-rc1~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2844744346d19f4d980c7033a4a230579daa5a7c;p=thirdparty%2Flibvirt.git virsh: Let prohibit_newline_at_end_of_diagnostic check pass The prohibit_newline_at_end_of_diagnostic syntax check is confused when another unrelated translatable message with a newline is too close to the function it is supposed to check. Refactoring the code to make the two strings further apart seems like the easiest solution. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index c8c341b3d1..cc5ae60536 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -12307,12 +12307,13 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd) return ret; cleanup: - if (!ret) { - vshError(ctl, "%s", _("Failed to detach interface")); - } else { + if (ret) { vshPrintExtra(ctl, "%s", _("Interface detached successfully\n")); + return true; } - return ret; + + vshError(ctl, "%s", _("Failed to detach interface")); + return false; } diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 2821cd9e26..dbd849bb3b 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -1758,11 +1758,13 @@ cmdDomainSnapshotRevert(vshControl *ctl, const vshCmd *cmd) result = virDomainRevertToSnapshot(snapshot, flags); } - if (result < 0) + if (result < 0) { vshError(ctl, _("Failed to revert snapshot %1$s"), name); - else - vshPrintExtra(ctl, _("Domain snapshot %1$s reverted\n"), name); - return result >= 0; + return false; + } + + vshPrintExtra(ctl, _("Domain snapshot %1$s reverted\n"), name); + return true; } /*