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.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index 9b72f76662..b7d1d22505 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -25,21 +25,26 @@
#include <string.h>
#include <unistd.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 "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 "util.h"
-#include "install.h"
-#include "fd-util.h"
typedef struct {
OrderedHashmap *will_install;
@@ -48,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);
}
@@ -925,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;
@@ -934,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)
@@ -950,8 +957,6 @@ static int config_parse_also(
if (r < 0)
return r;
}
- if (!isempty(state))
- log_syntax(unit, LOG_ERR, filename, line, 0, "Trailing garbage, ignoring.");
return 0;
}