summaryrefslogtreecommitdiff
path: root/src/shared/conf-parser.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-06-03 23:57:30 +0900
committerSven Eden <yamakuzure@gmx.net>2018-08-24 16:47:08 +0200
commit19608fbfbab0e48fcda2e1ac60f5b5a689fe3376 (patch)
tree9709342d1760362063d0ea84dace5474e126697d /src/shared/conf-parser.c
parent0809ca2a5a48ba63a3ba0d5d579d897547751c36 (diff)
conf-parse: use path_simplify_and_warn() in config_parse_path()
Diffstat (limited to 'src/shared/conf-parser.c')
-rw-r--r--src/shared/conf-parser.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index 899711e54..5e25eef18 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -42,6 +42,7 @@
//#include "rlimit-util.h"
//#include "rlimit-util.h"
//#include "rlimit-util.h"
+//#include "rlimit-util.h"
int config_item_table_lookup(
const void *table,
@@ -731,6 +732,7 @@ int config_parse_path(
char **s = data, *n;
bool fatal = ltype;
+ int r;
assert(filename);
assert(lvalue);
@@ -742,27 +744,16 @@ int config_parse_path(
goto finalize;
}
- if (!utf8_is_valid(rvalue)) {
- log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, rvalue);
- return fatal ? -ENOEXEC : 0;
- }
-
- if (!path_is_absolute(rvalue)) {
- log_syntax(unit, LOG_ERR, filename, line, 0,
- "Not an absolute path%s: %s",
- fatal ? "" : ", ignoring", rvalue);
- return fatal ? -ENOEXEC : 0;
- }
-
n = strdup(rvalue);
if (!n)
return log_oom();
- path_simplify(n, false);
+ r = path_simplify_and_warn(n, PATH_CHECK_ABSOLUTE | (fatal ? PATH_CHECK_FATAL : 0), unit, filename, line, lvalue);
+ if (r < 0)
+ return fatal ? -ENOEXEC : 0;
finalize:
- free(*s);
- *s = n;
+ free_and_replace(*s, n);
return 0;
}