]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
path-util: check validity before normalization in path_simplify_and_warn()
authorLennart Poettering <lennart@poettering.net>
Thu, 7 Mar 2019 09:37:04 +0000 (10:37 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 12 Mar 2019 15:08:57 +0000 (16:08 +0100)
As the normalization check includes a validation check the order
matters.

src/basic/path-util.c

index 221517303ecd62fafada920f5c077c5b18f30cde..084e0a9f29d79525f9545bc607420245a1b14fe7 100644 (file)
@@ -1132,17 +1132,17 @@ int path_simplify_and_warn(
 
         path_simplify(path, true);
 
-        if (!path_is_normalized(path)) {
+        if (!path_is_valid(path)) {
                 log_syntax(unit, LOG_ERR, filename, line, 0,
-                           "%s= path is not normalized%s: %s",
-                           lvalue, fatal ? "" : ", ignoring", path);
+                           "%s= path has invalid length (%zu bytes)%s.",
+                           lvalue, strlen(path), fatal ? "" : ", ignoring");
                 return -EINVAL;
         }
 
-        if (!path_is_valid(path)) {
+        if (!path_is_normalized(path)) {
                 log_syntax(unit, LOG_ERR, filename, line, 0,
-                           "%s= path has invalid length (%zu bytes)%s.",
-                           lvalue, strlen(path), fatal ? "" : ", ignoring");
+                           "%s= path is not normalized%s: %s",
+                           lvalue, fatal ? "" : ", ignoring", path);
                 return -EINVAL;
         }