From: Lennart Poettering Date: Mon, 19 Apr 2021 15:50:02 +0000 (+0200) Subject: repart: port more code to generic path_simplify_and_warn() X-Git-Tag: v249-rc1~388^2~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0ade2213e6a515f30dd587d9378958675e0ea245;p=thirdparty%2Fsystemd.git repart: port more code to generic path_simplify_and_warn() We have this nice helper, hence use it when parsing paths and logging about it. --- diff --git a/src/partition/repart.c b/src/partition/repart.c index 6ad12772fdd..46da0d04edc 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -1139,11 +1139,9 @@ static int config_parse_copy_files( return 0; } - if (!path_is_absolute(resolved_source) || !path_is_normalized(resolved_source)) { - log_syntax(unit, LOG_WARNING, filename, line, 0, - "Invalid path name in CopyFiles= source, ignoring: %s", resolved_source); + r = path_simplify_and_warn(resolved_source, PATH_CHECK_ABSOLUTE, unit, filename, line, lvalue); + if (r < 0) return 0; - } r = specifier_printf(target, specifier_table, NULL, &resolved_target); if (r < 0) { @@ -1152,11 +1150,9 @@ static int config_parse_copy_files( return 0; } - if (!path_is_absolute(resolved_target) || !path_is_normalized(resolved_target)) { - log_syntax(unit, LOG_WARNING, filename, line, 0, - "Invalid path name in CopyFiles= source, ignoring: %s", resolved_target); + r = path_simplify_and_warn(resolved_target, PATH_CHECK_ABSOLUTE, unit, filename, line, lvalue); + if (r < 0) return 0; - } r = strv_consume_pair(&partition->copy_files, TAKE_PTR(resolved_source), TAKE_PTR(resolved_target)); if (r < 0)