summaryrefslogtreecommitdiffstats
path: root/common/exechelp-posix.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus.brinkmann@ruhr-uni-bochum.de>2012-01-03 22:12:37 +0100
committerWerner Koch <wk@gnupg.org>2012-01-25 14:50:47 +0100
commit7a7a59782766a8bde0c3e7156d14bb2b0e4a3951 (patch)
tree9a22b6f581fe07e990014d860a2647b4df54d33a /common/exechelp-posix.c
parentRequire gitlog-to-changelog to be installed. (diff)
downloadgnupg2-7a7a59782766a8bde0c3e7156d14bb2b0e4a3951.tar.xz
gnupg2-7a7a59782766a8bde0c3e7156d14bb2b0e4a3951.zip
Port to npth.
* configure.ac: Don't check for PTH but for NPTH. (AH_BOTTOM): Remove PTH_SYSCALL_SOFT. (have_pth): Rename to ... (have_npth): ... this. (USE_GNU_NPTH): Rename to ... (USE_GNU_PTH): ... this. * m4/npth.m4: New file. * agent/Makefile.am, agent/cache.c, agent/call-pinentry.c, agent/call-scd.c, agent/findkey.c, agent/gpg-agent.c, agent/trustlist.c, common/Makefile.am, common/estream.c, common/exechelp-posix.c, common/exechelp-w32.c, common/exechelp-w32ce.c, common/http.c, common/init.c, common/sysutils.c, dirmngr/Makefile.am, dirmngr/crlfetch.c, dirmngr/dirmngr.c, dirmngr/dirmngr_ldap.c, dirmngr/ldap-wrapper-ce.c, dirmngr/ldap-wrapper.c, dirmngr/ldap.c, g13/Makefile.am, g13/call-gpg.c, g13/g13.c, g13/runner.c, scd/Makefile.am, scd/apdu.c, scd/app.c, scd/ccid-driver.c, scd/command.c, scd/scdaemon.c, tools/Makefile.am: Port to npth.
Diffstat (limited to 'common/exechelp-posix.c')
-rw-r--r--common/exechelp-posix.c36
1 files changed, 10 insertions, 26 deletions
diff --git a/common/exechelp-posix.c b/common/exechelp-posix.c
index 5479fe3fc..976d0dde5 100644
--- a/common/exechelp-posix.c
+++ b/common/exechelp-posix.c
@@ -35,13 +35,13 @@
#include <unistd.h>
#include <fcntl.h>
-#ifdef WITHOUT_GNU_PTH /* Give the Makefile a chance to build without Pth. */
-#undef HAVE_PTH
-#undef USE_GNU_PTH
+#ifdef WITHOUT_NPTH /* Give the Makefile a chance to build without Pth. */
+#undef HAVE_NPTH
+#undef USE_NPTH
#endif
-#ifdef USE_GNU_PTH
-#include <pth.h>
+#ifdef USE_NPTH
+#include <npth.h>
#endif
#include <sys/wait.h>
@@ -388,11 +388,7 @@ gnupg_spawn_process (const char *pgmname, const char *argv[],
}
-#ifdef USE_GNU_PTH
- *pid = pth_fork? pth_fork () : fork ();
-#else
*pid = fork ();
-#endif
if (*pid == (pid_t)(-1))
{
err = gpg_err_make (errsource, gpg_err_code_from_syserror ());
@@ -454,11 +450,7 @@ gnupg_spawn_process_fd (const char *pgmname, const char *argv[],
{
gpg_error_t err;
-#ifdef USE_GNU_PTH
- *pid = pth_fork? pth_fork () : fork ();
-#else
*pid = fork ();
-#endif
if (*pid == (pid_t)(-1))
{
err = gpg_error_from_syserror ();
@@ -491,16 +483,12 @@ gnupg_wait_process (const char *pgmname, pid_t pid, int hang, int *r_exitcode)
if (pid == (pid_t)(-1))
return gpg_error (GPG_ERR_INV_VALUE);
-#ifdef USE_GNU_PTH
- if (pth_waitpid)
- i = pth_waitpid (pid, &status, hang? 0:WNOHANG);
- else
+#ifdef USE_NPTH
+ i = npth_waitpid (pid, &status, hang? 0:WNOHANG);
+#else
+ while ((i=waitpid (pid, &status, hang? 0:WNOHANG)) == (pid_t)(-1)
+ && errno == EINTR);
#endif
- {
- while ((i=waitpid (pid, &status, hang? 0:WNOHANG)) == (pid_t)(-1)
- && errno == EINTR)
- ;
- }
if (i == (pid_t)(-1))
{
@@ -569,11 +557,7 @@ gnupg_spawn_process_detached (const char *pgmname, const char *argv[],
if (access (pgmname, X_OK))
return gpg_error_from_syserror ();
-#ifdef USE_GNU_PTH
- pid = pth_fork? pth_fork () : fork ();
-#else
pid = fork ();
-#endif
if (pid == (pid_t)(-1))
{
log_error (_("error forking process: %s\n"), strerror (errno));