1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-04 13:51:24 +03:00

path-util: check validity before normalization in path_simplify_and_warn()

As the normalization check includes a validation check the order
matters.
This commit is contained in:
Lennart Poettering 2019-03-07 10:37:04 +01:00
parent 71ae7b576c
commit 458e60b3a9

View File

@ -1132,13 +1132,6 @@ int path_simplify_and_warn(
path_simplify(path, true);
if (!path_is_normalized(path)) {
log_syntax(unit, LOG_ERR, filename, line, 0,
"%s= path is not normalized%s: %s",
lvalue, fatal ? "" : ", ignoring", path);
return -EINVAL;
}
if (!path_is_valid(path)) {
log_syntax(unit, LOG_ERR, filename, line, 0,
"%s= path has invalid length (%zu bytes)%s.",
@ -1146,5 +1139,12 @@ int path_simplify_and_warn(
return -EINVAL;
}
if (!path_is_normalized(path)) {
log_syntax(unit, LOG_ERR, filename, line, 0,
"%s= path is not normalized%s: %s",
lvalue, fatal ? "" : ", ignoring", path);
return -EINVAL;
}
return 0;
}