1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

core/namespace: check error first, add missing assertion

This commit is contained in:
Mike Yuan 2024-04-21 23:32:01 +08:00
parent a0a09da45e
commit e2663cbd39
No known key found for this signature in database
GPG Key ID: 417471C0A40F58B3

View File

@ -1474,6 +1474,8 @@ static int follow_symlink(
_cleanup_free_ char *target = NULL;
int r;
assert(m);
/* Let's chase symlinks, but only one step at a time. That's because depending where the symlink points we
* might need to change the order in which we mount stuff. Hence: let's normalize piecemeal, and do one step at
* a time by specifying CHASE_STEP. This function returns 0 if we resolved one step, and > 0 if we reached the
@ -1614,13 +1616,13 @@ static int apply_one_mount(
host_os_release_id,
host_os_release_version_id,
host_os_release_level,
/* host_extension_scope */ NULL, /* Leave empty, we need to accept both system and portable */
/* host_extension_scope = */ NULL, /* Leave empty, we need to accept both system and portable */
extension_release,
class);
if (r == 0)
return log_debug_errno(SYNTHETIC_ERRNO(ESTALE), "Directory %s extension-release metadata does not match the root's", extension_name);
if (r < 0)
return log_debug_errno(r, "Failed to compare directory %s extension-release metadata with the root's os-release: %m", extension_name);
if (r == 0)
return log_debug_errno(SYNTHETIC_ERRNO(ESTALE), "Directory %s extension-release metadata does not match the root's", extension_name);
_fallthrough_;
}