mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
util: refactor virNodeSuspendSetNodeWakeup
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
9abf18ace7
commit
00a565aa78
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user