mirror of
https://github.com/systemd/systemd.git
synced 2025-01-03 05:18:09 +03:00
hibernate-util: make clear_efi_hibernate_location_and_warn return 1 if
actually cleared the variable
This commit is contained in:
parent
2dcc499bb8
commit
fbc88824b6
@ -60,7 +60,7 @@ static int run(int argc, char *argv[]) {
|
||||
return r;
|
||||
|
||||
if (arg_info.efi)
|
||||
clear_efi_hibernate_location_and_warn();
|
||||
(void) clear_efi_hibernate_location_and_warn();
|
||||
}
|
||||
|
||||
if (stat(arg_info.device, &st) < 0)
|
||||
|
@ -513,13 +513,17 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void clear_efi_hibernate_location_and_warn(void) {
|
||||
int clear_efi_hibernate_location_and_warn(void) {
|
||||
int r;
|
||||
|
||||
if (!is_efi_boot())
|
||||
return;
|
||||
return 0;
|
||||
|
||||
r = efi_set_variable(EFI_SYSTEMD_VARIABLE(HibernateLocation), NULL, 0);
|
||||
if (r == -ENOENT)
|
||||
return 0;
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to clear EFI variable HibernateLocation, ignoring: %m");
|
||||
return log_warning_errno(r, "Failed to clear EFI variable HibernateLocation: %m");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ int hibernation_is_safe(void);
|
||||
|
||||
int write_resume_config(dev_t devno, uint64_t offset, const char *device);
|
||||
|
||||
void clear_efi_hibernate_location_and_warn(void);
|
||||
int clear_efi_hibernate_location_and_warn(void);
|
||||
|
||||
/* Only for test-fiemap */
|
||||
int read_fiemap(int fd, struct fiemap **ret);
|
||||
|
@ -308,7 +308,7 @@ static int execute(
|
||||
|
||||
fail:
|
||||
if (SLEEP_OPERATION_IS_HIBERNATION(operation))
|
||||
clear_efi_hibernate_location_and_warn();
|
||||
(void) clear_efi_hibernate_location_and_warn();
|
||||
|
||||
return r;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user