From: Mike Yuan Date: Wed, 5 Mar 2025 16:01:04 +0000 (+0100) Subject: factory-reset-tool: error out if we can't cancel pending reset X-Git-Tag: v258-rc1~1162^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97be702ffcbe310c0660052ee53b9ed45d5d61ca;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/factory-reset/factory-reset-tool.c b/src/factory-reset/factory-reset-tool.c index 8bf57346011..bfb1a8d26fe 100644 --- a/src/factory-reset/factory-reset-tool.c +++ b/src/factory-reset/factory-reset-tool.c @@ -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)