[PATCH 12/13] virsh: Let prohibit_newline_at_end_of_diagnostic check pass

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 tools/virsh-domain.c   |  9 +++++----
 tools/virsh-snapshot.c | 10 ++++++----
 2 files changed, 11 insertions(+), 8 deletions(-)

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;
 }
 
 /*
-- 
2.48.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux