chiark / gitweb /
relicense to LGPLv2.1 (with exceptions)
[elogind.git] / src / install.c
index cfbd50ead954c93e518f19d05be6ef7f6402f5fe..080ae6a01dc327f25c397de263b96f9f812441e9 100644 (file)
@@ -6,16 +6,16 @@
   Copyright 2011 Lennart Poettering
 
   systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
   (at your option) any later version.
 
   systemd is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty <of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  General Public License for more details.
+  Lesser General Public License for more details.
 
-  You should have received a copy of the GNU General Public License
+  You should have received a copy of the GNU Lesser General Public License
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
@@ -26,6 +26,7 @@
 #include <fnmatch.h>
 
 #include "util.h"
+#include "mkdir.h"
 #include "hashmap.h"
 #include "set.h"
 #include "path-lookup.h"
@@ -72,9 +73,8 @@ static int get_config_path(UnitFileScope scope, bool runtime, const char *root_d
         case UNIT_FILE_SYSTEM:
 
                 if (root_dir && runtime)
-                        return -EINVAL;
-
-                if (runtime)
+                        asprintf(&p, "%s/run/systemd/system", root_dir);
+                else if (runtime)
                         p = strdup("/run/systemd/system");
                 else if (root_dir)
                         asprintf(&p, "%s/%s", root_dir, SYSTEM_CONFIG_UNIT_PATH);
@@ -1572,10 +1572,10 @@ UnitFileState unit_file_get_state(
                 }
 
                 if (lstat(path, &st) < 0) {
+                        r = -errno;
                         if (errno == ENOENT)
                                 continue;
 
-                        r = -errno;
                         goto finish;
                 }
 
@@ -1854,7 +1854,7 @@ int unit_file_get_list(
 
                         r = dirent_ensure_type(d, de);
                         if (r < 0) {
-                                if (errno == ENOENT)
+                                if (r == -ENOENT)
                                         continue;
 
                                 goto finish;