summaryrefslogtreecommitdiff
path: root/src/shared/install.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/install.c')
-rw-r--r--src/shared/install.c56
1 files changed, 31 insertions, 25 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index 3d2b5ae77f..b7d1d22505 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -21,23 +21,30 @@
#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 "alloc-util.h"
+#include "conf-files.h"
+#include "conf-parser.h"
+#include "dirent-util.h"
+#include "fd-util.h"
+#include "fs-util.h"
#include "hashmap.h"
-#include "set.h"
-#include "path-util.h"
+#include "install-printf.h"
+#include "install.h"
+#include "mkdir.h"
#include "path-lookup.h"
+#include "path-util.h"
+#include "set.h"
+#include "special.h"
+#include "stat-util.h"
+#include "string-table.h"
+#include "string-util.h"
#include "strv.h"
#include "unit-name.h"
-#include "install.h"
-#include "conf-parser.h"
-#include "conf-files.h"
-#include "install-printf.h"
-#include "special.h"
+#include "util.h"
typedef struct {
OrderedHashmap *will_install;
@@ -46,13 +53,12 @@ typedef struct {
static int in_search_path(const char *path, char **search) {
_cleanup_free_ char *parent = NULL;
- int r;
assert(path);
- r = path_get_parent(path, &parent);
- if (r < 0)
- return r;
+ parent = dirname_malloc(path);
+ if (!parent)
+ return -ENOMEM;
return strv_contains(search, parent);
}
@@ -923,8 +929,6 @@ static int config_parse_also(
void *data,
void *userdata) {
- size_t l;
- const char *word, *state;
InstallContext *c = data;
UnitFileInstallInfo *i = userdata;
@@ -932,13 +936,18 @@ static int config_parse_also(
assert(lvalue);
assert(rvalue);
- FOREACH_WORD_QUOTED(word, l, rvalue, state) {
- _cleanup_free_ char *n;
+ for(;;) {
+ _cleanup_free_ char *n = NULL;
int r;
- n = strndup(word, l);
- if (!n)
- return -ENOMEM;
+ r = extract_first_word(&rvalue, &n, NULL, 0);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse config %s, ignoring.", rvalue);
+ return 0;
+ }
+
+ if (r == 0)
+ break;
r = install_info_add(c, n, NULL);
if (r < 0)
@@ -948,9 +957,6 @@ static int config_parse_also(
if (r < 0)
return r;
}
- if (!isempty(state))
- log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Trailing garbage, ignoring.");
return 0;
}