summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2015-07-06 23:00:49 +0200
committerKay Sievers <kay@vrfy.org>2015-07-06 23:02:47 +0200
commitde8763b6d23963e14787556de159d813e863043f (patch)
treef59607d173c2b1c927b4c5c499cc4a036b5a46d8 /src
parenteff8efe671e9ffa81e80ad13f791a32262567dfe (diff)
get_process_environ: exit early when there is nothing to read
Diffstat (limited to 'src')
-rw-r--r--src/basic/process-util.c3
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;