summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/shared/install.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index 881f715a07..2c119e2dca 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1638,10 +1638,14 @@ int unit_file_get_default(
r = readlink_malloc(path, &tmp);
if (r == -ENOENT)
continue;
- if (r < 0)
+ else if (r == -EINVAL)
+ /* not a symlink */
+ n = strdup(SPECIAL_DEFAULT_TARGET);
+ else if (r < 0)
return r;
+ else
+ n = strdup(path_get_file_name(tmp));
- n = strdup(path_get_file_name(tmp));
if (!n)
return -ENOMEM;