chiark / gitweb /
net-util: add inet address/family parsing
[elogind.git] / src / shared / install.c
index 3bced1a5eeb830910b58bc58b74e5475c3f01bc7..cfd4a5af8acad9f038ed4b2b4473cd74f93ee0d7 100644 (file)
@@ -44,7 +44,6 @@ typedef struct {
         Hashmap *have_installed;
 } InstallContext;
 
-#define _cleanup_lookup_paths_free_ _cleanup_(lookup_paths_free)
 #define _cleanup_install_context_done_ _cleanup_(install_context_done)
 
 static int lookup_paths_init_from_scope(LookupPaths *paths, UnitFileScope scope) {
@@ -1619,6 +1618,7 @@ int unit_file_get_default(
 
         STRV_FOREACH(p, paths.unit_path) {
                 _cleanup_free_ char *path = NULL, *tmp = NULL;
+                char *n;
 
                 if (isempty(root_dir))
                         path = strappend(*p, "/default.target");
@@ -1631,13 +1631,14 @@ int unit_file_get_default(
                 r = readlink_malloc(path, &tmp);
                 if (r == -ENOENT)
                         continue;
-                else if (r < 0)
+                if (r < 0)
                         return r;
 
-                *name = strdup(path_get_file_name(tmp));
-                if (!*name)
+                n = strdup(path_get_file_name(tmp));
+                if (!n)
                         return -ENOMEM;
 
+                *name = n;
                 return 0;
         }