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: 046f419f80
This commit is contained in:
Werner Koch 2021-03-08 21:40:50 +01:00
parent 33c492dcb9
commit a4021d9be4
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 11 additions and 2 deletions

View File

@ -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" */