]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/shared/install.c
util-lib: split our string related calls from util.[ch] into its own file string...
[thirdparty/systemd.git] / src / shared / install.c
index 559fda211dbd95b581d0eccc171392e048f3cbc7..5368623b74c5a429fe35a9bdc47ff7d45b038540 100644 (file)
 
 #include <errno.h>
 #include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
 #include <fnmatch.h>
+#include <string.h>
+#include <unistd.h>
 
-#include "util.h"
-#include "mkdir.h"
+#include "conf-files.h"
+#include "conf-parser.h"
 #include "hashmap.h"
-#include "set.h"
-#include "path-util.h"
+#include "install-printf.h"
+#include "mkdir.h"
 #include "path-lookup.h"
+#include "path-util.h"
+#include "set.h"
+#include "special.h"
+#include "string-util.h"
 #include "strv.h"
 #include "unit-name.h"
+#include "util.h"
 #include "install.h"
-#include "conf-parser.h"
-#include "conf-files.h"
-#include "install-printf.h"
-#include "special.h"
 
 typedef struct {
         OrderedHashmap *will_install;
@@ -949,8 +950,7 @@ static int config_parse_also(
                         return r;
         }
         if (!isempty(state))
-                log_syntax(unit, LOG_ERR, filename, line, EINVAL,
-                           "Trailing garbage, ignoring.");
+                log_syntax(unit, LOG_ERR, filename, line, 0, "Trailing garbage, ignoring.");
 
         return 0;
 }
@@ -2190,6 +2190,7 @@ int unit_file_get_list(
                         _cleanup_(unit_file_list_free_onep) UnitFileList *f = NULL;
                         struct dirent *de;
                         _cleanup_free_ char *path = NULL;
+                        bool also = false;
 
                         errno = 0;
                         de = readdir(d);
@@ -2243,7 +2244,7 @@ int unit_file_get_list(
                         if (!path)
                                 return -ENOMEM;
 
-                        r = unit_file_can_install(&paths, root_dir, path, true, NULL);
+                        r = unit_file_can_install(&paths, root_dir, path, true, &also);
                         if (r == -EINVAL ||  /* Invalid setting? */
                             r == -EBADMSG || /* Invalid format? */
                             r == -ENOENT     /* Included file not found? */)
@@ -2253,7 +2254,7 @@ int unit_file_get_list(
                         else if (r > 0)
                                 f->state = UNIT_FILE_DISABLED;
                         else
-                                f->state = UNIT_FILE_STATIC;
+                                f->state = also ? UNIT_FILE_INDIRECT : UNIT_FILE_STATIC;
 
                 found:
                         r = hashmap_put(h, basename(f->path), f);
@@ -2263,7 +2264,7 @@ int unit_file_get_list(
                 }
         }
 
-        return r;
+        return 0;
 }
 
 static const char* const unit_file_state_table[_UNIT_FILE_STATE_MAX] = {