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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user