core: Fix -EOPNOTSUPP emergency action error string
authorAaron Plattner <aplattner@nvidia.com>
Wed, 16 Jan 2019 18:26:15 +0000 (10:26 -0800)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 17 Jan 2019 08:17:15 +0000 (09:17 +0100)
commit119f0f2876ea340cc41525e844487aa88551c219
tree88189c96833f883a7c972d117eba6d6b3f748aaf
parentdb2df5500ef3027476ce2434e6f4432cc0aa6b64
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
src/core/dbus-unit.c