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/sysv-generator | |
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/sysv-generator')
-rw-r--r-- | src/sysv-generator/sysv-generator.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c index 087ba08559..92669c6758 100644 --- a/src/sysv-generator/sysv-generator.c +++ b/src/sysv-generator/sysv-generator.c @@ -240,7 +240,7 @@ static char *sysv_translate_name(const char *name) { if (res) *res = 0; - if (unit_name_mangle(c, UNIT_NAME_NOGLOB, &res) < 0) + if (unit_name_mangle(c, 0, &res) < 0) return NULL; return res; |