diff options
Diffstat (limited to 'src/core/load-fragment.c')
-rw-r--r-- | src/core/load-fragment.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 5b7471c0d0..af3c6a4606 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -392,7 +392,9 @@ int config_parse_socket_listen(const char *unit, r = socket_address_parse_and_warn(&p->address, k); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse address value, ignoring: %s", rvalue); + if (r != -EAFNOSUPPORT) + log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse address value, ignoring: %s", rvalue); + return 0; } @@ -3907,6 +3909,7 @@ int config_parse_bind_paths( void *userdata) { ExecContext *c = data; + Unit *u = userdata; const char *p; int r; @@ -3926,6 +3929,7 @@ int config_parse_bind_paths( p = rvalue; for (;;) { _cleanup_free_ char *source = NULL, *destination = NULL; + _cleanup_free_ char *sresolved = NULL, *dresolved = NULL; char *s = NULL, *d = NULL; bool rbind = true, ignore_enoent = false; @@ -3939,7 +3943,14 @@ int config_parse_bind_paths( return 0; } - s = source; + r = unit_full_printf(u, source, &sresolved); + if (r < 0) { + log_syntax(unit, LOG_ERR, filename, line, r, + "Failed to resolved specifiers in \"%s\", ignoring: %m", source); + return 0; + } + + s = sresolved; if (s[0] == '-') { ignore_enoent = true; s++; @@ -3970,16 +3981,23 @@ int config_parse_bind_paths( return 0; } - if (!utf8_is_valid(destination)) { - log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, destination); + r = unit_full_printf(u, destination, &dresolved); + if (r < 0) { + log_syntax(unit, LOG_ERR, filename, line, r, + "Failed to resolved specifiers in \"%s\", ignoring: %m", destination); + return 0; + } + + if (!utf8_is_valid(dresolved)) { + log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, dresolved); return 0; } - if (!path_is_absolute(destination)) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Not an absolute destination path, ignoring: %s", destination); + if (!path_is_absolute(dresolved)) { + log_syntax(unit, LOG_ERR, filename, line, 0, "Not an absolute destination path, ignoring: %s", dresolved); return 0; } - d = path_kill_slashes(destination); + d = path_kill_slashes(dresolved); /* Optionally, there's also a short option string specified */ if (p && p[-1] == ':') { |