1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-22 22:03:43 +03:00

sleep: clear EFI HibernateLocation if writing kernel config fails

Follow-up for f1f331a252d22c15f37d03524cce967664358c5c

(cherry picked from commit 031a399d87de5a47d395bb12b70e112c83b02c3f)
(cherry picked from commit f2fad1523986d9385a670a51f0332031dfe2f07e)
This commit is contained in:
Mike Yuan 2023-08-13 22:59:30 +08:00 committed by Luca Boccassi
parent ef7eedb8c0
commit 1a77552257

View File

@ -23,6 +23,7 @@
#include "bus-locator.h" #include "bus-locator.h"
#include "bus-util.h" #include "bus-util.h"
#include "constants.h" #include "constants.h"
#include "efivars.h"
#include "exec-util.h" #include "exec-util.h"
#include "fd-util.h" #include "fd-util.h"
#include "fileio.h" #include "fileio.h"
@ -224,8 +225,12 @@ static int execute(
* do it ourselves then. > 0 means: kernel already had a configured hibernation * do it ourselves then. > 0 means: kernel already had a configured hibernation
* location which we shouldn't touch. */ * location which we shouldn't touch. */
r = write_hibernate_location_info(hibernate_location); r = write_hibernate_location_info(hibernate_location);
if (r < 0) if (r < 0) {
if (is_efi_boot())
(void) efi_set_variable(EFI_SYSTEMD_VARIABLE(HibernateLocation), NULL, 0);
return log_error_errno(r, "Failed to prepare for hibernation: %m"); return log_error_errno(r, "Failed to prepare for hibernation: %m");
}
} }
r = write_mode(modes); r = write_mode(modes);