]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: Let prohibit_newline_at_end_of_diagnostic check pass
authorJiri Denemark <jdenemar@redhat.com>
Thu, 20 Feb 2025 13:41:32 +0000 (14:41 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 24 Feb 2025 10:14:11 +0000 (11:14 +0100)
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 <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tools/virsh-domain.c
tools/virsh-snapshot.c

index c8c341b3d12abb38972d2aaba4e961d650e502dd..cc5ae6053606be6706c73e24da7089e7bd6ff4b4 100644 (file)
@@ -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;
 }
 
 
index 2821cd9e26621c7c67cd26d3151ed5373e281bfd..dbd849bb3b4a065d8d2e899cff1b791259992138 100644 (file)
@@ -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;
 }
 
 /*