[libvirt PATCH 4/5] util: refactor virNodeSuspendSetNodeWakeup

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

 



Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/util/virnodesuspend.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c
index 451d798363..c92232dfe9 100644
--- a/src/util/virnodesuspend.c
+++ b/src/util/virnodesuspend.c
@@ -73,8 +73,7 @@ static void virNodeSuspendUnlock(void)
  */
 static int virNodeSuspendSetNodeWakeup(unsigned long long alarmTime)
 {
-    virCommand *setAlarmCmd;
-    int ret = -1;
+    g_autoptr(virCommand) setAlarmCmd = NULL;
 
     if (alarmTime < MIN_TIME_REQ_FOR_SUSPEND) {
         virReportError(VIR_ERR_INVALID_ARG,
@@ -86,14 +85,7 @@ static int virNodeSuspendSetNodeWakeup(unsigned long long alarmTime)
     setAlarmCmd = virCommandNewArgList("rtcwake", "-m", "no", "-s", NULL);
     virCommandAddArgFormat(setAlarmCmd, "%lld", alarmTime);
 
-    if (virCommandRun(setAlarmCmd, NULL) < 0)
-        goto cleanup;
-
-    ret = 0;
-
- cleanup:
-    virCommandFree(setAlarmCmd);
-    return ret;
+    return virCommandRun(setAlarmCmd, NULL);
 }
 
 /**
-- 
2.31.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