diff options
author | Werner Koch <[email protected]> | 2010-05-03 15:23:10 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2010-05-03 15:23:10 +0000 |
commit | 8524ac000c0755e61194c63a32efd648ab689b84 (patch) | |
tree | 852719e710835377f1cec313b9e25b9b2471896b /common/exechelp-posix.c | |
parent | Provide a useful pinentry prompt. (diff) | |
download | gnupg-8524ac000c0755e61194c63a32efd648ab689b84.tar.gz gnupg-8524ac000c0755e61194c63a32efd648ab689b84.zip |
auto start the agent if --use-standard-socket is in use.
Diffstat (limited to 'common/exechelp-posix.c')
-rw-r--r-- | common/exechelp-posix.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/common/exechelp-posix.c b/common/exechelp-posix.c index 7b94ee7f0..aaf628715 100644 --- a/common/exechelp-posix.c +++ b/common/exechelp-posix.c @@ -410,7 +410,8 @@ gnupg_spawn_process_fd (const char *pgmname, const char *argv[], diagnostics. Returns 0 if the process succeeded, GPG_ERR_GENERAL for any failures of the spawned program or other error codes. If EXITCODE is not NULL the exit code of the process is stored at this - address or -1 if it could not be retrieved. */ + address or -1 if it could not be retrieved and no error message is + logged. */ gpg_error_t gnupg_wait_process (const char *pgmname, pid_t pid, int *exitcode) { @@ -443,9 +444,10 @@ 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; } @@ -497,13 +499,16 @@ 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 take over the new child. */ + if (pid2 == (pid_t)(-1)) _exit (1); - if (pid) + if (pid2) _exit (0); /* Let the parent exit immediately. */ if (envp) |