ssh-generator: follow symlink when searching for sshd@.service
unit_file_exists() currently does not follow symlinks, as it is mainly used to test whether the unit (of any install state) has been seen under search dirs. However, in ssh-generator we should search for and honor whatever the distro ships, which might be an alias or linked externally.
This commit is contained in:
@@ -475,7 +475,10 @@ static int run(const char *dest, const char *dest_early, const char *dest_late)
|
||||
return r;
|
||||
|
||||
_cleanup_free_ char *found_sshd_template_unit = NULL;
|
||||
r = unit_file_exists_full(RUNTIME_SCOPE_SYSTEM, &lp, "sshd@.service", &found_sshd_template_unit);
|
||||
r = unit_file_exists_full(RUNTIME_SCOPE_SYSTEM, &lp,
|
||||
/* follow = */ true,
|
||||
"sshd@.service",
|
||||
&found_sshd_template_unit);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Unable to detect if sshd@.service exists: %m");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user