1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-06 13:17:44 +03:00

sleep: clear EFI HibernateLocation if writing kernel config fails

Follow-up for f1f331a252

(cherry picked from commit 031a399d87)
(cherry picked from commit f2fad15239)
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-util.h"
#include "constants.h"
#include "efivars.h"
#include "exec-util.h"
#include "fd-util.h"
#include "fileio.h"
@ -224,8 +225,12 @@ static int execute(
* do it ourselves then. > 0 means: kernel already had a configured hibernation
* location which we shouldn't touch. */
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");
}
}
r = write_mode(modes);