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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2017-06-23 20:46:33 -04:00
parent 62c460c6e2
commit d233c99ac8
2 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -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);
+5 -3
View File
@@ -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;