shared/install: remove two conditionals which are always false

The name argument in UnitFileInstallInfo (i->name) should always be a unit
file name, so the conditional always takes the 'else' branch.

The only call chain that links to find_symlinks_fd() is unit_file_lookup_state
→ find_symlinks_in_scope → find_symlinks → find_symlinks_fd. But
unit_file_lookup_state calls unit_name_is_valid(name), and then name is used
to construct the UnitFileInstallInfo object in install_info_discover, which just
uses the name it was given.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-12-13 00:57:16 +01:00
parent 26526f9826
commit 2eded6cb2c

View file

@ -794,23 +794,15 @@ static int find_symlinks_fd(
if (!x)
return -ENOMEM;
free(dest);
dest = x;
free_and_replace(dest, x);
}
/* Check if the symlink itself matches what we
* are looking for */
if (path_is_absolute(i->name))
found_path = path_equal(p, i->name);
else
found_path = streq(de->d_name, i->name);
/* Check if the symlink itself matches what we are looking for */
assert(unit_name_is_valid(i->name, UNIT_NAME_ANY));
found_path = streq(de->d_name, i->name);
/* Check if what the symlink points to
* matches what we are looking for */
if (path_is_absolute(i->name))
found_dest = path_equal(dest, i->name);
else
found_dest = streq(basename(dest), i->name);
/* Check if what the symlink points to matches what we are looking for */
found_dest = streq(basename(dest), i->name);
if (found_path && found_dest) {
_cleanup_free_ char *t = NULL;