summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-07-23 23:47:54 +0200
committerLennart Poettering <lennart@poettering.net>2015-07-23 23:47:54 +0200
commit03c55bc0b980e2a6aaf6f166a9271ed8ecce2222 (patch)
tree9db685d41a7044a3fe24c50c43d8346a5d17dd42
parenta644184a177caa709e1bb784e4f169101194b610 (diff)
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.
-rw-r--r--src/basic/process-util.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index 66395b7de9..61f188467f 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;