diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-10-14 19:39:28 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-10-14 19:39:28 +0200 |
commit | 64f283c39b1b8311f4dd99466ecc8df7e4407950 (patch) | |
tree | 33528fafccaf94de0ec165007446ec662623973f /src/core/dbus-execute.c | |
parent | 6777e2ad7282bb52076b92e130cba17cebb81b02 (diff) | |
parent | e0d6e0fa55054b7eacf58c511abff710fef5712f (diff) |
Merge pull request #1528 from evverx/systemd-run-syslog-pri-fac
systemd-run can launch units with SyslogLevel and SyslogFacility
Diffstat (limited to 'src/core/dbus-execute.c')
-rw-r--r-- | src/core/dbus-execute.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index 88db179958..8b1f830476 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c @@ -881,6 +881,38 @@ int bus_exec_context_set_transient_property( } return 1; + } else if (streq(name, "SyslogLevel")) { + int level; + + r = sd_bus_message_read(message, "i", &level); + if (r < 0) + return r; + + if (!log_level_is_valid(level)) + return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Log level value out of range"); + + if (mode != UNIT_CHECK) { + c->syslog_priority = (c->syslog_priority & LOG_FACMASK) | level; + unit_write_drop_in_private_format(u, mode, name, "SyslogLevel=%i\n", level); + } + + return 1; + } else if (streq(name, "SyslogFacility")) { + int facility; + + r = sd_bus_message_read(message, "i", &facility); + if (r < 0) + return r; + + if (!log_facility_unshifted_is_valid(facility)) + return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Log facility value out of range"); + + if (mode != UNIT_CHECK) { + c->syslog_priority = (facility << 3) | LOG_PRI(c->syslog_priority); + unit_write_drop_in_private_format(u, mode, name, "SyslogFacility=%i\n", facility); + } + + return 1; } else if (streq(name, "Nice")) { int n; |