process: an empty environment block should be returned as such

An empty env block is completely valid, hence return it as such, and
don't turn it into an error.
This commit is contained in:
Lennart Poettering
2015-07-23 23:47:54 +02:00
parent a644184a17
commit 03c55bc0b9
+6 -3
View File
@@ -351,10 +351,13 @@ int get_process_environ(pid_t pid, char **env) {
sz += cescape_char(c, outcome + sz);
}
if (sz == 0)
return -ENOENT;
if (!outcome) {
outcome = strdup("");
if (!outcome)
return -ENOMEM;
} else
outcome[sz] = '\0';
outcome[sz] = '\0';
*env = outcome;
outcome = NULL;