shared/install: provide a nicer error message for invalid WantedBy=/Required= values
$ build/systemctl --user cat badinstall # /home/zbyszek/.config/systemd/user/badinstall.service [Service] ExecStart=true [Install] WantedBy=asdf $ build/systemctl --user enable badinstall Failed to enable unit: "asdf" is not a valid unit name. Fixes #4209.
This commit is contained in:
@@ -1902,6 +1902,12 @@ static int install_error(
|
||||
"Unit %s is transient or generated.", changes[i].path);
|
||||
goto found;
|
||||
|
||||
case -EUCLEAN:
|
||||
r = sd_bus_error_setf(error, BUS_ERROR_BAD_UNIT_SETTING,
|
||||
"\"%s\" is not a valid unit name.",
|
||||
changes[i].path);
|
||||
goto found;
|
||||
|
||||
case -ELOOP:
|
||||
r = sd_bus_error_setf(error, BUS_ERROR_UNIT_LINKED,
|
||||
"Refusing to operate on alias name or linked unit file: %s",
|
||||
|
||||
Reference in New Issue
Block a user