get_process_environ: exit early when there is nothing to read

This commit is contained in:
Kay Sievers
2015-07-06 23:02:47 +02:00
parent eff8efe671
commit de8763b6d2
+3
View File
@@ -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;