chiark / gitweb /
install: when determining where default.target points to, accept a file instead of...
authorLennart Poettering <lennart@poettering.net>
Tue, 19 Nov 2013 20:02:16 +0000 (21:02 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 20 Nov 2013 18:37:02 +0000 (19:37 +0100)
src/shared/install.c

index 881f715..2c119e2 100644 (file)
@@ -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;