From: Zbigniew Jędrzejewski-Szmek Date: Fri, 23 Jun 2017 23:20:54 +0000 (-0400) Subject: manager: just warn about an invalid environment entry X-Git-Tag: v234~103^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d233c99ac8125daa04e87f67cf13ee01fe3d9a1c;p=platform%2Fupstream%2Fsystemd.git manager: just warn about an invalid environment entry Apart from bugs (as in #6152), this can happen if we ever make our requirements for environment entries more stringent. As with the rest of deserialization, we should just warn and continue. --- diff --git a/src/basic/env-util.c b/src/basic/env-util.c index e79b441..c2a6f6f 100644 --- a/src/basic/env-util.c +++ b/src/basic/env-util.c @@ -788,7 +788,7 @@ int serialize_environment(FILE *f, char **environment) { } int deserialize_environment(char ***environment, const char *line) { - char *uce = NULL; + char *uce; int r; assert(line); diff --git a/src/core/manager.c b/src/core/manager.c index 876210f..2837207 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -2588,8 +2588,8 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) { m->n_reloading++; for (;;) { - char line[LINE_MAX], *l; - const char *val; + char line[LINE_MAX]; + const char *val, *l; if (!fgets(line, sizeof(line), f)) { if (feof(f)) @@ -2665,8 +2665,10 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) { dual_timestamp_deserialize(val, &m->units_load_finish_timestamp); else if (startswith(l, "env=")) { r = deserialize_environment(&m->environment, l); + if (r == -ENOMEM) + goto finish; if (r < 0) - return r; + log_notice_errno(r, "Failed to parse environment entry: \"%s\": %m", l); } else if ((val = startswith(l, "notify-fd="))) { int fd;