diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-03-21 15:26:47 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-03-21 15:26:47 +0100 |
commit | 37cbc1d57992f49b3607bd66973dd30e0a8d1073 (patch) | |
tree | 495e940367f2cf5534c43b14af602c344969accf /src/escape | |
parent | Merge pull request #8523 from keszybz/oss-fuzz-fixes (diff) | |
download | systemd-37cbc1d57992f49b3607bd66973dd30e0a8d1073.tar.xz systemd-37cbc1d57992f49b3607bd66973dd30e0a8d1073.zip |
When mangling names, optionally emit a warning (#8400)
The warning is not emitted for absolute paths like /dev/sda or /home, which are
converted to .device and .mount unit names without any fuss.
Most of the time it's unlikely that users use invalid unit names on purpose,
so let's warn them. Warnings are silenced when --quiet is used.
$ build/systemctl show -p Id hello@foo-bar/baz
Invalid unit name "hello@foo-bar/baz" was escaped as "hello@foo-bar-baz" (maybe you should use systemd-escape?)
Id=hello@foo-bar-baz.service
$ build/systemd-run --user --slice foo-bar/baz --unit foo-bar/foo true
Invalid unit name "foo-bar/foo" was escaped as "foo-bar-foo" (maybe you should use systemd-escape?)
Invalid unit name "foo-bar/baz" was escaped as "foo-bar-baz" (maybe you should use systemd-escape?)
Running as unit: foo-bar-foo.service
Fixes #8302.
Diffstat (limited to 'src/escape')
-rw-r--r-- | src/escape/escape.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/escape/escape.c b/src/escape/escape.c index 9c35b4663e..2eb0a58673 100644 --- a/src/escape/escape.c +++ b/src/escape/escape.c @@ -217,7 +217,7 @@ int main(int argc, char *argv[]) { break; case ACTION_MANGLE: - r = unit_name_mangle(*i, UNIT_NAME_NOGLOB, &e); + r = unit_name_mangle(*i, 0, &e); if (r < 0) { log_error_errno(r, "Failed to mangle name: %m"); goto finish; |