diff options
author | Nicolas Braud-Santoni <nicolas@braud-santoni.eu> | 2016-04-12 18:00:19 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-04-12 18:00:19 +0200 |
commit | 1116e14c49ac1291eb5e46fcf5e691ef57267b54 (patch) | |
tree | d352d07bbd52cdf7029ad2dca4c65b87e8c47cce /src | |
parent | 1ade1cc0bfde6171e9142ec8ed6d2c3492367b7d (diff) |
load-fragment: Resolve specifiers in DeviceAllow (#3019)
Closes #1602
Diffstat (limited to 'src')
-rw-r--r-- | src/core/load-fragment.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index f1a874cfdf..a54f0d764c 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -2847,11 +2847,12 @@ int config_parse_device_allow( void *data, void *userdata) { - _cleanup_free_ char *path = NULL; + _cleanup_free_ char *path = NULL, *t = NULL; CGroupContext *c = data; CGroupDeviceAllow *a; - const char *m; + const char *m = NULL; size_t n; + int r; if (isempty(rvalue)) { while (c->device_allow) @@ -2860,8 +2861,16 @@ int config_parse_device_allow( return 0; } - n = strcspn(rvalue, WHITESPACE); - path = strndup(rvalue, n); + r = unit_full_printf(userdata, rvalue, &t); + if(r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to resolve specifiers in %s, ignoring: %m", + rvalue); + } + + n = strcspn(t, WHITESPACE); + + path = strndup(t, n); if (!path) return log_oom(); @@ -2872,7 +2881,7 @@ int config_parse_device_allow( return 0; } - m = rvalue + n + strspn(rvalue + n, WHITESPACE); + m = t + n + strspn(t + n, WHITESPACE); if (isempty(m)) m = "rwm"; |