core: Fix -EOPNOTSUPP emergency action error string

The error string for operations that are not supported (e.g. "shutdown" for
user-defined units) should take two arguments, where the first one is the type
of action being defined (i.e. "FailureAction" vs. "SuccessAction") and the
second is the string that was invalid.

Currently, the code prints this:

 $ systemd-run --user --wait -p SuccessAction=poweroff true
 Failed to start transient service unit: EmergencyAction setting invalid for manager type: SuccessAction

Change the format string to instead print:

 $ systemd-run --user --wait -p SuccessAction=poweroff true
 Failed to start transient service unit: SuccessAction setting invalid for manager type: poweroff
This commit is contained in:
Aaron Plattner 2019-01-16 10:26:15 -08:00 committed by Zbigniew Jędrzejewski-Szmek
parent db2df5500e
commit 119f0f2876
1 changed files with 1 additions and 1 deletions

View File

@ -1387,7 +1387,7 @@ static int bus_set_transient_emergency_action(
r = parse_emergency_action(s, system, &v);
if (r < 0)
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
r == -EOPNOTSUPP ? "EmergencyAction setting invalid for manager type: %s"
r == -EOPNOTSUPP ? "%s setting invalid for manager type: %s"
: "Invalid %s setting: %s",
name, s);