path: support specifier resolvin in .path units
This commit is contained in:
parent
cd8651982b
commit
93e4c84bb3
|
@ -186,7 +186,7 @@ int config_parse_unit_path_printf(
|
||||||
|
|
||||||
k = unit_full_printf(u, rvalue);
|
k = unit_full_printf(u, rvalue);
|
||||||
if (!k)
|
if (!k)
|
||||||
return -ENOMEM;
|
return log_oom();
|
||||||
|
|
||||||
r = config_parse_path(filename, line, section, lvalue, ltype, k, data, userdata);
|
r = config_parse_path(filename, line, section, lvalue, ltype, k, data, userdata);
|
||||||
free(k);
|
free(k);
|
||||||
|
@ -1193,32 +1193,36 @@ int config_parse_path_spec(
|
||||||
Path *p = data;
|
Path *p = data;
|
||||||
PathSpec *s;
|
PathSpec *s;
|
||||||
PathType b;
|
PathType b;
|
||||||
|
char *k;
|
||||||
|
|
||||||
assert(filename);
|
assert(filename);
|
||||||
assert(lvalue);
|
assert(lvalue);
|
||||||
assert(rvalue);
|
assert(rvalue);
|
||||||
assert(data);
|
assert(data);
|
||||||
|
|
||||||
if ((b = path_type_from_string(lvalue)) < 0) {
|
b = path_type_from_string(lvalue);
|
||||||
|
if (b < 0) {
|
||||||
log_error("[%s:%u] Failed to parse path type, ignoring: %s", filename, line, lvalue);
|
log_error("[%s:%u] Failed to parse path type, ignoring: %s", filename, line, lvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!path_is_absolute(rvalue)) {
|
k = unit_full_printf(UNIT(p), rvalue);
|
||||||
log_error("[%s:%u] Path is not absolute, ignoring: %s", filename, line, rvalue);
|
if (!k)
|
||||||
|
return log_oom();
|
||||||
|
|
||||||
|
if (!path_is_absolute(k)) {
|
||||||
|
log_error("[%s:%u] Path is not absolute, ignoring: %s", filename, line, k);
|
||||||
|
free(k);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(s = new0(PathSpec, 1)))
|
s = new0(PathSpec, 1);
|
||||||
return -ENOMEM;
|
if (!s) {
|
||||||
|
free(k);
|
||||||
if (!(s->path = strdup(rvalue))) {
|
return log_oom();
|
||||||
free(s);
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
path_kill_slashes(s->path);
|
s->path = path_kill_slashes(k);
|
||||||
|
|
||||||
s->type = b;
|
s->type = b;
|
||||||
s->inotify_fd = -1;
|
s->inotify_fd = -1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue