From e8372f7e3e3a5aba053b1b5b944cb84d6d525877 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 19 Nov 2013 21:02:16 +0100 Subject: [PATCH] install: when determining where default.target points to, accept a file instead of a symlink, too --- src/shared/install.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/shared/install.c b/src/shared/install.c index 881f715a075..2c119e2dcad 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;