1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-31 14:50:15 +03:00

load-fragment: Resolve specifiers in DeviceAllow (#3019)

Closes #1602
This commit is contained in:
Nicolas Braud-Santoni 2016-04-12 18:00:19 +02:00 committed by Lennart Poettering
parent 1ade1cc0bf
commit 1116e14c49

View File

@ -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";