I don't know why, but getppid() returns wrong result for me when application is started

This commit is contained in:
Ilya Fedin 2020-05-07 16:17:06 +04:00
parent 07e851fcc8
commit b2ac83a76e
4 changed files with 40 additions and 7 deletions

2
exec.c
View file

@ -79,7 +79,7 @@ static int exec_common(execve_func_t function, const char *filename, char* const
DEBUG("filename %s, fullpath %s\n", filename, fullpath);
char* const *env = envp;
if (is_external_process(fullpath)) {
DEBUG("External process detected. Restoring env vars from parent %d\n", getppid());
DEBUG("External process detected. Restoring env vars from parent %d\n", get_parent_pid());
env = read_parent_env();
if (!env)
env = envp;