agent, dirmngr, scd: Fix init_common_subsystems.

* common/init.c (_init_common_subsystems): Don't call
gpgrt_set_syscall_clamp in this function.
* agent/gpg-agent.c, dirmngr/dirmngr.c, scd/scdaemon.c: Call
gpgrt_set_syscall_clamp after npth_init.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2016-10-07 10:45:22 +09:00
parent 4aadc751f2
commit fc0b392e76
4 changed files with 4 additions and 11 deletions

View File

@ -941,6 +941,7 @@ thread_init_once (void)
npth_initialized++; npth_initialized++;
npth_init (); npth_init ();
} }
gpgrt_set_syscall_clamp (npth_unprotect, npth_protect);
} }

View File

@ -29,20 +29,12 @@
#include <config.h> #include <config.h>
#ifdef WITHOUT_NPTH /* Give the Makefile a chance to build without Pth. */
#undef HAVE_NPTH
#undef USE_NPTH
#endif
#ifdef HAVE_W32_SYSTEM #ifdef HAVE_W32_SYSTEM
# ifdef HAVE_WINSOCK2_H # ifdef HAVE_WINSOCK2_H
# include <winsock2.h> # include <winsock2.h>
# endif # endif
# include <windows.h> # include <windows.h>
#endif #endif
#ifdef HAVE_NPTH
# include <npth.h>
#endif
#ifdef HAVE_W32CE_SYSTEM #ifdef HAVE_W32CE_SYSTEM
# include <assuan.h> /* For _assuan_w32ce_finish_pipe. */ # include <assuan.h> /* For _assuan_w32ce_finish_pipe. */
#endif #endif
@ -197,9 +189,6 @@ _init_common_subsystems (gpg_err_source_t errsource, int *argcp, char ***argvp)
/* Initialize the Estream library. */ /* Initialize the Estream library. */
gpgrt_init (); gpgrt_init ();
gpgrt_set_alloc_func (gcry_realloc); gpgrt_set_alloc_func (gcry_realloc);
#ifdef USE_NPTH
gpgrt_set_syscall_clamp (npth_unprotect, npth_protect);
#endif
/* Special hack for Windows CE: We extract some options from arg /* Special hack for Windows CE: We extract some options from arg
to setup the standard handles. */ to setup the standard handles. */

View File

@ -651,6 +651,7 @@ static void
thread_init (void) thread_init (void)
{ {
npth_init (); npth_init ();
gpgrt_set_syscall_clamp (npth_unprotect, npth_protect);
/* Now with NPth running we can set the logging callback. Our /* Now with NPth running we can set the logging callback. Our
windows implementation does not yet feature the NPth TLS windows implementation does not yet feature the NPth TLS

View File

@ -723,6 +723,7 @@ main (int argc, char **argv )
#endif #endif
npth_init (); npth_init ();
gpgrt_set_syscall_clamp (npth_unprotect, npth_protect);
/* If --debug-allow-core-dump has been given we also need to /* If --debug-allow-core-dump has been given we also need to
switch the working directory to a place where we can actually switch the working directory to a place where we can actually
@ -862,6 +863,7 @@ main (int argc, char **argv )
/* This is the child. */ /* This is the child. */
npth_init (); npth_init ();
gpgrt_set_syscall_clamp (npth_unprotect, npth_protect);
/* Detach from tty and put process into a new session. */ /* Detach from tty and put process into a new session. */
if (!nodetach ) if (!nodetach )