factory-reset-tool: error out if we can't cancel pending reset

First of all, it seems very unlikely that we'd be in the pending state
if not booted via EFI in the first place. Moreover, the operation didn't
work out, hence let's not spurious report success.
This commit is contained in:
Mike Yuan
2025-03-05 17:01:04 +01:00
parent f1d790a18b
commit 97be702ffc

View File

@@ -209,12 +209,9 @@ static int verb_cancel(int argc, char *argv[], void *userdata) {
return 0;
}
if (!is_efi_boot()) {
if (!arg_quiet)
log_info("Not an EFI boot, cannot remove FactoryResetMode EFI variable, not cancelling.");
return 0;
}
if (!is_efi_boot())
return log_error_errno(SYNTHETIC_ERRNO(ENOTRECOVERABLE),
"Not an EFI boot, cannot remove FactoryResetMode EFI variable, not cancelling.");
r = efi_set_variable(EFI_SYSTEMD_VARIABLE_STR("FactoryResetRequest"), /* value= */ NULL, /* size= */ 0);
if (r < 0)