1
0
mirror of https://github.com/systemd/systemd synced 2025-10-05 11:44:45 +02:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Beniamino Galvani
8f5eaeb143 sd-dhcp6-lease: fix calculation of t2
sd_dhcp6_lease_get_t2() was returning t1, and so the client was going directly
to the rebind state skipping the lease renewal.

Reported-by: Jaime Caamano <jcaamano@redhat.com>
Fixes: 394fac52d0e7 ("sd-dhcp6-client: introduce sd_dhcp6_lease_get_t1() and friends")
2025-07-22 02:15:43 +09:00
Yu Watanabe
7107cfbf4f bootctl: do not fail when the same file is updated multiple times
In the second or later trial, copy_file_with_version_check() -> version_check()
fails with -ESRCH. Let's ignore the failure.

This also adds missing assertions in update_efi_boot_binaries(), and
drop redundant version check in update_efi_boot_binaries(), as version
will be anyway checked later.

Fixes a regression caused by 929f41c6528fb630753d4e2f588a8eb6c2f6a609.
Fixes #33392.
2025-07-21 16:07:08 +01:00
2 changed files with 8 additions and 11 deletions

View File

@ -340,6 +340,9 @@ static int update_efi_boot_binaries(const char *esp_path, const char *source_pat
_cleanup_free_ char *p = NULL;
int r, ret = 0;
assert(esp_path);
assert(source_path);
r = chase_and_opendir("/EFI/BOOT", esp_path, CHASE_PREFIX_ROOT|CHASE_PROHIBIT_SYMLINKS, &p, &d);
if (r == -ENOENT)
return 0;
@ -348,7 +351,6 @@ static int update_efi_boot_binaries(const char *esp_path, const char *source_pat
FOREACH_DIRENT(de, d, break) {
_cleanup_close_ int fd = -EBADF;
_cleanup_free_ char *v = NULL;
if (!endswith_no_case(de->d_name, ".efi"))
continue;
@ -365,19 +367,14 @@ static int update_efi_boot_binaries(const char *esp_path, const char *source_pat
if (r == 0)
continue;
r = get_file_version(fd, &v);
if (r == -ESRCH)
continue; /* No version information */
if (r < 0)
return r;
if (!startswith(v, "systemd-boot "))
continue;
_cleanup_free_ char *dest_path = path_join(p, de->d_name);
if (!dest_path)
return log_oom();
RET_GATHER(ret, copy_file_with_version_check(source_path, dest_path, /* force = */ false));
r = copy_file_with_version_check(source_path, dest_path, /* force = */ false);
if (IN_SET(r, -ESTALE, -ESRCH))
continue;
RET_GATHER(ret, r);
}
return ret;

View File

@ -115,7 +115,7 @@ static void dhcp6_lease_set_lifetime(sd_dhcp6_lease *lease) {
}
DEFINE_GET_TIME_FUNCTIONS(t1, lifetime_t1);
DEFINE_GET_TIME_FUNCTIONS(t2, lifetime_t1);
DEFINE_GET_TIME_FUNCTIONS(t2, lifetime_t2);
DEFINE_GET_TIME_FUNCTIONS(valid_lifetime, lifetime_valid);
static void dhcp6_lease_set_server_address(sd_dhcp6_lease *lease, const struct in6_addr *server_address) {