summaryrefslogtreecommitdiff
path: root/src/shared/install.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/install.c')
-rw-r--r--src/shared/install.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index bb2eff7387..0f2d407a36 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1324,26 +1324,27 @@ static int unit_file_load_or_readlink(
const char *path,
const char *root_dir,
SearchFlags flags) {
-
- _cleanup_free_ char *target = NULL;
+ struct stat st;
int r;
r = unit_file_load(c, info, path, root_dir, flags);
if (r != -ELOOP || (flags & SEARCH_DROPIN))
return r;
- /* This is a symlink, let's read it. */
-
- r = readlink_malloc(path, &target);
- if (r < 0)
- return r;
-
- if (path_equal(target, "/dev/null"))
+ r = chase_symlinks_and_stat(path, root_dir, CHASE_WARN, NULL, &st, NULL);
+ if (r > 0 && null_or_empty(&st))
info->type = UNIT_FILE_TYPE_MASKED;
else {
+ _cleanup_free_ char *target = NULL;
const char *bn;
UnitType a, b;
+ /* This is a symlink, let's read it. */
+
+ r = readlink_malloc(path, &target);
+ if (r < 0)
+ return r;
+
bn = basename(target);
if (unit_name_is_valid(info->name, UNIT_NAME_PLAIN)) {