[systemd-devel] [PATCH 3/3] core: add EnvironmentFiles to settable transient unit properties

Hristo Venev hristo at venev.name
Fri Mar 28 10:38:52 PDT 2014


---
 src/core/dbus-execute.c          | 16 ++++++++++++++++
 src/libsystemd/sd-bus/bus-util.c | 18 +++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index 13b3d0d..1f1f602 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -851,6 +851,22 @@ int bus_exec_context_set_transient_property(
 
                 return 1;
 
+        } else if (streq(name, "EnvironmentFiles")) {
+
+                _cleanup_strv_free_ char **l = NULL;
+
+                r = sd_bus_message_read_strv(message, &l);
+                if (r < 0)
+                        return r;
+
+                if (mode != UNIT_CHECK) {
+                        r = strv_extend_strv(&c->environment_files, l);
+                        if (r < 0)
+                                return r;
+                }
+
+                return 1;
+
         } else if (rlimit_from_string(name) >= 0) {
                 uint64_t rl;
                 rlim_t x;
diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/libsystemd/sd-bus/bus-util.c
index df7ab8a..b7be4bc 100644
--- a/src/libsystemd/sd-bus/bus-util.c
+++ b/src/libsystemd/sd-bus/bus-util.c
@@ -1291,7 +1291,23 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
         } else if (STR_IN_SET(field, "User", "Group", "DevicePolicy", "KillMode"))
                 r = sd_bus_message_append(m, "v", "s", eq);
 
-        else if (streq(field, "DeviceAllow")) {
+        else if (streq(field, "EnvironmentFiles")) {
+                _cleanup_strv_free_ char **l = strv_split_quoted(eq);
+                if(!l) return -ENOMEM;
+
+                r = sd_bus_message_open_container(m, 'v', "as");
+                if (r < 0) {
+                    return bus_log_create_error(r);
+                }
+
+                r = sd_bus_message_append_strv(m, l);
+                if (r < 0) {
+                    return bus_log_create_error(r);
+                }
+
+                r = sd_bus_message_close_container(m);
+
+        } else if (streq(field, "DeviceAllow")) {
 
                 if (isempty(eq))
                         r = sd_bus_message_append(m, "v", "a(ss)", 0);
-- 
1.9.1



More information about the systemd-devel mailing list