]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/install: replace streq + basename with path_equal_filename
authorMike Yuan <me@yhndnzj.com>
Wed, 1 May 2024 07:44:07 +0000 (15:44 +0800)
committerLuca Boccassi <bluca@debian.org>
Tue, 11 Jun 2024 22:17:21 +0000 (23:17 +0100)
src/shared/install.c

index c5812c67a6bb4bf2a7f4458d6197af8916375ed4..06613235f96a2207a946177366c6b172ff1cbd25 100644 (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;
                 }