diff --git a/src/shared/install.c b/src/shared/install.c index 28a801f..a7244f4 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -1338,13 +1338,21 @@ static int install_info_symlink_requires( STRV_FOREACH(s, i->required_by) { char *path; + char *instance = NULL; + char *prefix = NULL; + char *dst = NULL; - if (!unit_name_is_valid(*s, true)) { + unit_name_to_instance(i->name, &instance); + prefix = unit_name_to_prefix(i->name); + + dst = name_printf(prefix, instance, *s); + + if (!unit_name_is_valid(dst, true)) { r = -EINVAL; continue; } - if (asprintf(&path, "%s/%s.requires/%s", config_path, *s, i->name) < 0) + if (asprintf(&path, "%s/%s.requires/%s", config_path, dst, i->name) < 0) return -ENOMEM; q = create_symlink(i->path, path, force, changes, n_changes);