summaryrefslogtreecommitdiffstats
path: root/src/shared/parse-helpers.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-02-05 16:32:57 +0100
committerLennart Poettering <lennart@poettering.net>2024-02-06 11:13:28 +0100
commite0f6eaeb4f171329a6cdea4768555de8e2be3d39 (patch)
tree4a4af044899f3485e7e076b62a1544ea4e650f56 /src/shared/parse-helpers.c
parentdbus: make dbus property parsing of WorkingDirectory= equally strict as loadi... (diff)
downloadsystemd-e0f6eaeb4f171329a6cdea4768555de8e2be3d39.tar.xz
systemd-e0f6eaeb4f171329a6cdea4768555de8e2be3d39.zip
parse-helpers: adjust log level when we say we ignore to LOG_WARNING
Diffstat (limited to '')
-rw-r--r--src/shared/parse-helpers.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/shared/parse-helpers.c b/src/shared/parse-helpers.c
index d397f73131..ca6842d363 100644
--- a/src/shared/parse-helpers.c
+++ b/src/shared/parse-helpers.c
@@ -19,6 +19,7 @@ int path_simplify_and_warn(
const char *lvalue) {
bool fatal = flags & PATH_CHECK_FATAL;
+ int level = fatal ? LOG_ERR : LOG_WARNING;
assert(path);
assert(!FLAGS_SET(flags, PATH_CHECK_ABSOLUTE | PATH_CHECK_RELATIVE));
@@ -33,12 +34,12 @@ int path_simplify_and_warn(
absolute = path_is_absolute(path);
if (!absolute && (flags & PATH_CHECK_ABSOLUTE))
- return log_syntax(unit, LOG_ERR, filename, line, SYNTHETIC_ERRNO(EINVAL),
+ return log_syntax(unit, level, filename, line, SYNTHETIC_ERRNO(EINVAL),
"%s= path is not absolute%s: %s",
lvalue, fatal ? "" : ", ignoring", path);
if (absolute && (flags & PATH_CHECK_RELATIVE))
- return log_syntax(unit, LOG_ERR, filename, line, SYNTHETIC_ERRNO(EINVAL),
+ return log_syntax(unit, level, filename, line, SYNTHETIC_ERRNO(EINVAL),
"%s= path is absolute%s: %s",
lvalue, fatal ? "" : ", ignoring", path);
}
@@ -46,17 +47,17 @@ int path_simplify_and_warn(
path_simplify_full(path, flags & PATH_KEEP_TRAILING_SLASH ? PATH_SIMPLIFY_KEEP_TRAILING_SLASH : 0);
if (!path_is_valid(path))
- return log_syntax(unit, LOG_ERR, filename, line, SYNTHETIC_ERRNO(EINVAL),
+ return log_syntax(unit, level, filename, line, SYNTHETIC_ERRNO(EINVAL),
"%s= path has invalid length (%zu bytes)%s.",
lvalue, strlen(path), fatal ? "" : ", ignoring");
if (!path_is_normalized(path))
- return log_syntax(unit, LOG_ERR, filename, line, SYNTHETIC_ERRNO(EINVAL),
+ return log_syntax(unit, level, filename, line, SYNTHETIC_ERRNO(EINVAL),
"%s= path is not normalized%s: %s",
lvalue, fatal ? "" : ", ignoring", path);
if (FLAGS_SET(flags, PATH_CHECK_NON_API_VFS) && path_below_api_vfs(path))
- return log_syntax(unit, LOG_ERR, filename, line, SYNTHETIC_ERRNO(EINVAL),
+ return log_syntax(unit, level, filename, line, SYNTHETIC_ERRNO(EINVAL),
"%s= path is below API VFS%s: %s",
lvalue, fatal ? ", refusing" : ", ignoring",
path);