diff options
author | Kay Sievers <kay@vrfy.org> | 2015-07-06 23:00:49 +0200 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2015-07-06 23:02:47 +0200 |
commit | de8763b6d23963e14787556de159d813e863043f (patch) | |
tree | f59607d173c2b1c927b4c5c499cc4a036b5a46d8 /src/basic | |
parent | eff8efe671e9ffa81e80ad13f791a32262567dfe (diff) |
get_process_environ: exit early when there is nothing to read
Diffstat (limited to 'src/basic')
-rw-r--r-- | src/basic/process-util.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c index cfc876567d..2c05f2fee4 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -329,6 +329,9 @@ int get_process_environ(pid_t pid, char **env) { sz += cescape_char(c, outcome + sz); } + if (sz == 0) + return -ENOENT; + outcome[sz] = '\0'; *env = outcome; outcome = NULL; |