]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemd-run: can launch units with SyslogFacility
authorEvgeny Vereshchagin <evvers@ya.ru>
Sun, 11 Oct 2015 03:55:41 +0000 (03:55 +0000)
committerEvgeny Vereshchagin <evvers@ya.ru>
Wed, 14 Oct 2015 15:05:04 +0000 (15:05 +0000)
src/core/dbus-execute.c
src/shared/bus-util.c

index 73290002f6fd69bbb5bdde9b61518bde4e9bd93e..b87192a9aebe25c2231b924c40ed19dbc4ce38be 100644 (file)
@@ -893,6 +893,19 @@ int bus_exec_context_set_transient_property(
                         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 (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;
index bf9320b0e0fe79c898fbf2912c777604d14b2be0..3a45ac4064262e1b776af04523c7dfa12081fa57 100644 (file)
@@ -1508,6 +1508,17 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
 
                 r = sd_bus_message_append(m, "v", "i", level);
 
+        } else if (streq(field, "SyslogFacility")) {
+                int facility;
+
+                facility = log_facility_unshifted_from_string(eq);
+                if (facility < 0) {
+                        log_error("Failed to parse %s value %s.", field, eq);
+                        return -EINVAL;
+                }
+
+                r = sd_bus_message_append(m, "v", "i", facility);
+
         } else if (streq(field, "DeviceAllow")) {
 
                 if (isempty(eq))