aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2021-03-08 20:40:50 +0000
committerWerner Koch <[email protected]>2021-03-08 20:53:29 +0000
commita4021d9be4aeac7429bf6a8e9f336dbb62cacfc4 (patch)
tree5bf8cb699da615ea9653c53a014b57f1e4ae079d
parentw32: Cleanup use of pid_t in call-daemon (diff)
downloadgnupg-a4021d9be4aeac7429bf6a8e9f336dbb62cacfc4.tar.gz
gnupg-a4021d9be4aeac7429bf6a8e9f336dbb62cacfc4.zip
sm: Init nPth which might be used by some helper code.
* sm/gpgsm.c: Include npth.h. (main): Init nPth. -- Actually we currently do not use extra threads but we need to link to the npth version of the common functions because there is an option to use threads. Now, without initialized npth, we could experience a crash in gnupg_sleep, which uses npth_usleep in the npth based common functions. Fixes-commit: 046f419f806036248c058c4bd44368f8596287b7
-rw-r--r--sm/gpgsm.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sm/gpgsm.c b/sm/gpgsm.c
index 4a466050c..fd59fc7c7 100644
--- a/sm/gpgsm.c
+++ b/sm/gpgsm.c
@@ -29,6 +29,7 @@
#include <unistd.h>
#include <fcntl.h>
/*#include <mcheck.h>*/
+#include <npth.h>
#define INCLUDED_BY_MAIN_MODULE 1
@@ -568,6 +569,10 @@ our_md_test_algo (int algo)
}
+/* nPth wrapper function definitions. */
+ASSUAN_SYSTEM_NPTH_IMPL;
+
+
static char *
make_libversion (const char *libname, const char *(*getfnc)(const char*))
{
@@ -1624,18 +1629,22 @@ main ( int argc, char **argv)
gpgrt_strusage(11), gpgrt_strusage(13), gpgrt_strusage(14) );
es_fprintf (es_stderr, "%s\n", gpgrt_strusage(15) );
}
-# ifdef IS_DEVELOPMENT_VERSION
+#ifdef IS_DEVELOPMENT_VERSION
if (!opt.batch)
{
log_info ("NOTE: THIS IS A DEVELOPMENT VERSION!\n");
log_info ("It is only intended for test purposes and should NOT be\n");
log_info ("used in a production environment or with production keys!\n");
}
-# endif
+#endif
if (may_coredump && !opt.quiet)
log_info (_("WARNING: program may create a core file!\n"));
+ npth_init ();
+ assuan_set_system_hooks (ASSUAN_SYSTEM_NPTH);
+ gpgrt_set_syscall_clamp (npth_unprotect, npth_protect);
+
/* if (opt.qualsig_approval && !opt.quiet) */
/* log_info (_("This software has officially been approved to " */
/* "create and verify\n" */