diff options
Diffstat (limited to 'common/exechelp.c')
-rw-r--r-- | common/exechelp.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/common/exechelp.c b/common/exechelp.c index a5e25fd5d..cd9ba7b40 100644 --- a/common/exechelp.c +++ b/common/exechelp.c @@ -872,9 +872,11 @@ gnupg_wait_process (const char *pgmname, pid_t pid, int *exitcode) } else if (WIFEXITED (status) && WEXITSTATUS (status)) { - log_error (_("error running `%s': exit status %d\n"), pgmname, - WEXITSTATUS (status)); - if (exitcode) + + if (!exitcode) + log_error (_("error running `%s': exit status %d\n"), pgmname, + WEXITSTATUS (status)); + else *exitcode = WEXITSTATUS (status); ec = GPG_ERR_GENERAL; } @@ -1002,13 +1004,15 @@ gnupg_spawn_process_detached (const char *pgmname, const char *argv[], } if (!pid) { + pid_t pid2; + gcry_control (GCRYCTL_TERM_SECMEM); if (setsid() == -1 || chdir ("/")) _exit (1); - pid = fork (); /* Double fork to let init takes over the new child. */ - if (pid == (pid_t)(-1)) + pid2 = fork (); /* Double fork to let init takes over the new child. */ + if (pid2 == (pid_t)(-1)) _exit (1); - if (pid) + if (pid2) _exit (0); /* Let the parent exit immediately. */ if (envp) |