diff options
author | Auke Kok <auke-jan.h.kok@intel.com> | 2013-02-12 15:28:00 -0800 |
---|---|---|
committer | Auke Kok <auke-jan.h.kok@intel.com> | 2013-02-12 15:28:00 -0800 |
commit | 8d6167101696a28b7ac61b48fd2c1920564c4e90 (patch) | |
tree | 72dddced047f2eb010b5f049199f0e6bb62e4939 /src/core/manager.c | |
parent | cd3bccaaf7b3c0e000cfd1bac638a52cb4f510c3 (diff) | |
parent | 726c6b6b3d82b8cdf0087375d4f95e4df4013c62 (diff) |
Merge branch 'master' of ssh://git.freedesktop.org/git/systemd/systemd into work
Diffstat (limited to 'src/core/manager.c')
-rw-r--r-- | src/core/manager.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/core/manager.c b/src/core/manager.c index 4bebb2996f..bd49892cd4 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); } |