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

[libvirt] [PATCH 2/3] util: do not repeat the pm-is-supported string



Use a 'binary' variable to hold it.

Signed-off-by: Ján Tomko <jtomko redhat com>
---
 src/util/virnodesuspend.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c
index af0ed615e1..62e62bb171 100644
--- a/src/util/virnodesuspend.c
+++ b/src/util/virnodesuspend.c
@@ -239,22 +239,23 @@ static int
 virNodeSuspendSupportsTargetPMUtils(unsigned int target, bool *supported)
 {
     VIR_AUTOPTR(virCommand) cmd = NULL;
+    const char *binary = "pm-is-supported";
     int status;
 
     *supported = false;
 
     switch (target) {
     case VIR_NODE_SUSPEND_TARGET_MEM:
-        cmd = virCommandNewArgList("pm-is-supported", "--suspend", NULL);
+        cmd = virCommandNewArgList(binary, "--suspend", NULL);
         break;
     case VIR_NODE_SUSPEND_TARGET_DISK:
-        cmd = virCommandNewArgList("pm-is-supported", "--hibernate", NULL);
+        cmd = virCommandNewArgList(binary, "--hibernate", NULL);
         break;
     case VIR_NODE_SUSPEND_TARGET_HYBRID:
-        cmd = virCommandNewArgList("pm-is-supported", "--suspend-hybrid", NULL);
+        cmd = virCommandNewArgList(binary, "--suspend-hybrid", NULL);
         break;
     default:
-        return ret;
+        return -1;
     }
 
     if (virCommandRun(cmd, &status) < 0)
-- 
2.19.2


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