summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;