[systemd-commits] 2 commits - src/core src/shared

Lennart Poettering lennart at kemper.freedesktop.org
Tue Feb 12 15:18:43 PST 2013


 src/core/manager.c   |   29 ++++++++++++++++++++++++++++-
 src/shared/efivars.c |    1 +
 2 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 726c6b6b3d82b8cdf0087375d4f95e4df4013c62
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 13 00:18:29 2013 +0100

    efi: add missing #include

diff --git a/src/shared/efivars.c b/src/shared/efivars.c
index 3e59ee5..70b6ce1 100644
--- a/src/shared/efivars.c
+++ b/src/shared/efivars.c
@@ -22,6 +22,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <fcntl.h>
+#include <ctype.h>
 
 #include "util.h"
 #include "utf8.h"

commit 4a9fd066f0804a41f3d34676101fb8fdc141ef13
Author: Oleksii Shevchuk <alxchk at gmail.com>
Date:   Tue Feb 12 01:14:39 2013 +0200

    manager: pass environment over daemon-reexec
    
    Fixes this bug:
    alxchk > systemctl --user set-environment A=B
    alxchk > systemctl --user show-environment | grep ^A=
    A=B
    alxchk > systemctl --user daemon-reexec
    alxchk > systemctl --user show-environment | grep ^A=
    alxchk >

diff --git a/src/core/manager.c b/src/core/manager.c
index 4bebb29..bd49892 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -1856,6 +1856,7 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds, bool serialize_jobs) {
         Iterator i;
         Unit *u;
         const char *t;
+        char **e;
         int r;
 
         assert(m);
@@ -1879,6 +1880,14 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds, bool serialize_jobs) {
                 dual_timestamp_serialize(f, "finish-timestamp", &m->finish_timestamp);
         }
 
+        STRV_FOREACH(e, m->environment) {
+                _cleanup_free_ char *ce;
+
+                ce = cescape(*e);
+                if (ce)
+                        fprintf(f, "env=%s\n", *e);
+        }
+
         fputc('\n', f);
 
         HASHMAP_FOREACH_KEY(u, t, m->units, i) {
@@ -1979,7 +1988,25 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
                         dual_timestamp_deserialize(l+20, &m->userspace_timestamp);
                 else if (startswith(l, "finish-timestamp="))
                         dual_timestamp_deserialize(l+17, &m->finish_timestamp);
-                else
+                else if (startswith(l, "env=")) {
+                        _cleanup_free_ char *uce = NULL;
+                        char **e;
+
+                        uce = cunescape(l+4);
+                        if (!uce) {
+                                r = -ENOMEM;
+                                goto finish;
+                        }
+
+                        e = strv_env_set(m->environment, uce);
+                        if (!e) {
+                                r = -ENOMEM;
+                                goto finish;
+                        }
+
+                        strv_free(m->environment);
+                        m->environment = e;
+                } else
                         log_debug("Unknown serialization item '%s'", l);
         }
 



More information about the systemd-commits mailing list