boot: use correct format specifier for timeout

This also drops space between number and 's', like we do in format_timespan(),
and fixes spurious type mismatch between timeout_sec and timeout_remain.
This commit is contained in:
Yu Watanabe
2025-09-24 18:20:10 +09:00
parent a359d92547
commit 2e3c792baf
2 changed files with 7 additions and 7 deletions
+6 -6
View File
@@ -244,7 +244,7 @@ static char16_t* update_timeout_efivar(Config *config, bool inc) {
case TIMEOUT_MENU_HIDDEN:
return xstrdup16(u"Menu hidden. Hold down key at bootup to show menu.");
default:
return xasprintf("Menu timeout set to %u s.", (uint32_t)config->timeout_sec_efivar);
return xasprintf("Menu timeout set to %"PRIu64"s.", config->timeout_sec_efivar);
}
}
@@ -279,7 +279,7 @@ static void print_timeout_status(const char *label, uint64_t t) {
case TIMEOUT_MENU_HIDDEN:
return (void) printf("%s: menu-hidden\n", label);
default:
return (void) printf("%s: %u s\n", label, (uint32_t)t);
return (void) printf("%s: %"PRIu64"s\n", label, t);
}
}
@@ -343,7 +343,7 @@ static void print_status(Config *config, char16_t *loaded_image_path) {
printf(" reboot-on-error: %s\n", reboot_on_error_to_string(config->reboot_on_error));
printf(" secure-boot-enroll: %s\n", secure_boot_enroll_to_string(config->secure_boot_enroll));
printf(" secure-boot-enroll-action: %s\n", secure_boot_enroll_action_to_string(config->secure_boot_enroll_action));
printf("secure-boot-enroll-timeout-sec: %" PRIu64 "\n", config->secure_boot_enroll_timeout_sec);
printf("secure-boot-enroll-timeout-sec: %"PRIu64"s\n", config->secure_boot_enroll_timeout_sec);
switch (config->console_mode) {
case CONSOLE_MODE_AUTO:
@@ -477,8 +477,8 @@ static bool menu_run(
size_t x_start = 0, y_start = 0, y_status = 0, x_max, y_max;
_cleanup_strv_free_ char16_t **lines = NULL;
_cleanup_free_ char16_t *clearline = NULL, *separator = NULL, *status = NULL;
uint64_t timeout_efivar_saved = config->timeout_sec_efivar;
uint32_t timeout_remain = config->timeout_sec == TIMEOUT_MENU_FORCE ? 0 : config->timeout_sec;
uint64_t timeout_efivar_saved = config->timeout_sec_efivar,
timeout_remain = config->timeout_sec == TIMEOUT_MENU_FORCE ? 0 : config->timeout_sec;
int64_t console_mode_initial = ST->ConOut->Mode->Mode, console_mode_efivar_saved = config->console_mode_efivar;
size_t default_efivar_saved = config->idx_default_efivar;
@@ -622,7 +622,7 @@ static bool menu_run(
if (timeout_remain > 0) {
free(status);
status = xasprintf("Boot in %u s.", timeout_remain);
status = xasprintf("Boot in %"PRIu64"s.", timeout_remain);
}
if (status) {
+1 -1
View File
@@ -94,7 +94,7 @@ EFI_STATUS secure_boot_enroll_at(EFI_FILE *root_dir, const char16_t *path, bool
printf("Warning: Enrolling custom Secure Boot keys might soft-brick your machine!\n");
for (;;) {
printf("\rEnrolling in %" PRIu64 " s, press any key to abort.", timeout_sec);
printf("\rEnrolling in %"PRIu64"s, press any key to abort.", timeout_sec);
err = console_key_read(/* ret_key= */ NULL, /* timeout_usec= */ 1000 * 1000);
if (err == EFI_NOT_READY)