From: Lennart Poettering Date: Thu, 23 Jul 2015 21:47:54 +0000 (+0200) Subject: process: an empty environment block should be returned as such X-Git-Tag: v223~50^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=03c55bc0b980e2a6aaf6f166a9271ed8ecce2222;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/basic/process-util.c b/src/basic/process-util.c index 66395b7de9e..61f188467f8 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -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;