diff options
Diffstat (limited to 'src/basic/process-util.c')
-rw-r--r-- | src/basic/process-util.c | 9 |
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; |