]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sleep: clear EFI HibernateLocation if writing kernel config fails
authorMike Yuan <me@yhndnzj.com>
Sun, 13 Aug 2023 14:59:30 +0000 (22:59 +0800)
committerLuca Boccassi <luca.boccassi@gmail.com>
Sun, 13 Aug 2023 21:12:32 +0000 (22:12 +0100)
Follow-up for f1f331a252d22c15f37d03524cce967664358c5c

src/sleep/sleep.c

index de1f6c7ec1f7893084655f4bd858649e06eb47b3..76b69f817ae7c5830bba3e9a827ff0c968802990 100644 (file)
@@ -270,8 +270,12 @@ static int execute(
                                 return r;
 
                         r = write_kernel_hibernate_location(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);