summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-09 17:06:22 +0300
committerLennart Poettering <lennart@poettering.net>2015-10-09 17:06:22 +0300
commit2c882b8bfa29937fb808fa1dd60c2a7ab0e8e85e (patch)
tree4c2b70c9206fde2ab64f11a5c26e4ccdfbe5cd83 /src
parentce3cef2c52d928709674d8447b6c49062dd14a96 (diff)
parentdc800d8406fa2af0720974a35b38cc3452ad7233 (diff)
Merge pull request #1512 from evverx/systemd-run-syslog-properties
systemd-run can launch units with SyslogIdentifier and SyslogLevelPrefix
Diffstat (limited to 'src')
-rw-r--r--src/core/dbus-execute.c29
-rw-r--r--src/shared/bus-util.c5
2 files changed, 31 insertions, 3 deletions
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index adf613d328..030df55554 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -856,7 +856,32 @@ int bus_exec_context_set_transient_property(
}
return 1;
+ } else if (streq(name, "SyslogIdentifier")) {
+ const char *id;
+
+ r = sd_bus_message_read(message, "s", &id);
+ if (r < 0)
+ return r;
+
+ if (mode != UNIT_CHECK) {
+
+ if (isempty(id)) {
+ c->syslog_identifier = mfree(c->syslog_identifier);
+ } else {
+ char *t;
+ t = strdup(id);
+ if (!t)
+ return -ENOMEM;
+
+ free(c->syslog_identifier);
+ c->syslog_identifier = t;
+ }
+
+ unit_write_drop_in_private_format(u, mode, name, "SyslogIdentifier=%s\n", id);
+ }
+
+ return 1;
} else if (streq(name, "Nice")) {
int n;
@@ -998,7 +1023,7 @@ int bus_exec_context_set_transient_property(
} else if (STR_IN_SET(name,
"IgnoreSIGPIPE", "TTYVHangup", "TTYReset",
"PrivateTmp", "PrivateDevices", "PrivateNetwork",
- "NoNewPrivileges")) {
+ "NoNewPrivileges", "SyslogLevelPrefix")) {
int b;
r = sd_bus_message_read(message, "b", &b);
@@ -1020,6 +1045,8 @@ int bus_exec_context_set_transient_property(
c->private_network = b;
else if (streq(name, "NoNewPrivileges"))
c->no_new_privileges = b;
+ else if (streq(name, "SyslogLevelPrefix"))
+ c->syslog_level_prefix = b;
unit_write_drop_in_private_format(u, mode, name, "%s=%s\n", name, yes_no(b));
}
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index 10df3fc3d6..52ec7eee7f 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -1426,7 +1426,8 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
"CPUAccounting", "MemoryAccounting", "BlockIOAccounting", "TasksAccounting",
"SendSIGHUP", "SendSIGKILL", "WakeSystem", "DefaultDependencies",
"IgnoreSIGPIPE", "TTYVHangup", "TTYReset", "RemainAfterExit",
- "PrivateTmp", "PrivateDevices", "PrivateNetwork", "NoNewPrivileges")) {
+ "PrivateTmp", "PrivateDevices", "PrivateNetwork", "NoNewPrivileges",
+ "SyslogLevelPrefix")) {
r = parse_boolean(eq);
if (r < 0) {
@@ -1493,7 +1494,7 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
"UtmpIdentifier", "UtmpMode", "PAMName", "TTYPath",
"StandardInput", "StandardOutput", "StandardError",
"Description", "Slice", "Type", "WorkingDirectory",
- "RootDirectory"))
+ "RootDirectory", "SyslogIdentifier"))
r = sd_bus_message_append(m, "v", "s", eq);
else if (streq(field, "DeviceAllow")) {