1
0
mirror of https://github.com/systemd/systemd synced 2024-07-08 20:15:55 +00:00

shared/install: replace streq + basename with path_equal_filename

This commit is contained in:
Mike Yuan 2024-05-01 15:44:07 +08:00 committed by Luca Boccassi
parent d51c404507
commit 3e02c8d87d

View File

@ -1658,7 +1658,7 @@ static int install_info_follow(
/* If the basename doesn't match, the caller should add a complete new entry for this. */
if (!ignore_different_name && !streq(basename(info->symlink_target), info->name))
if (!ignore_different_name && !path_equal_filename(info->symlink_target, info->name))
return -EXDEV;
free_and_replace(info->path, info->symlink_target);
@ -3115,7 +3115,7 @@ int unit_file_lookup_state(
case INSTALL_MODE_REGULAR:
/* Check if the name we were querying is actually an alias */
if (!streq(name, basename(info->path)) && !unit_name_is_valid(info->name, UNIT_NAME_INSTANCE)) {
if (!path_equal_filename(name, info->path) && !unit_name_is_valid(info->name, UNIT_NAME_INSTANCE)) {
state = UNIT_FILE_ALIAS;
break;
}