diff options
author | Marcus Brinkmann <[email protected]> | 2012-01-03 21:12:37 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2012-01-25 13:50:47 +0000 |
commit | 7a7a59782766a8bde0c3e7156d14bb2b0e4a3951 (patch) | |
tree | 9a22b6f581fe07e990014d860a2647b4df54d33a /agent/trustlist.c | |
parent | Require gitlog-to-changelog to be installed. (diff) | |
download | gnupg-7a7a59782766a8bde0c3e7156d14bb2b0e4a3951.tar.gz gnupg-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 'agent/trustlist.c')
-rw-r--r-- | agent/trustlist.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/agent/trustlist.c b/agent/trustlist.c index 68dd83364..8604d8432 100644 --- a/agent/trustlist.c +++ b/agent/trustlist.c @@ -26,7 +26,7 @@ #include <assert.h> #include <unistd.h> #include <sys/stat.h> -#include <pth.h> +#include <npth.h> #include "agent.h" #include <assuan.h> /* fixme: need a way to avoid assuan calls here */ @@ -53,7 +53,7 @@ typedef struct trustitem_s trustitem_t; static trustitem_t *trusttable; static size_t trusttablesize; /* A mutex used to protect the table. */ -static pth_mutex_t trusttable_lock; +static npth_mutex_t trusttable_lock; @@ -81,11 +81,13 @@ void initialize_module_trustlist (void) { static int initialized; + int err; if (!initialized) { - if (!pth_mutex_init (&trusttable_lock)) - log_fatal ("error initializing mutex: %s\n", strerror (errno)); + err = npth_mutex_init (&trusttable_lock, NULL); + if (err) + log_fatal ("error initializing mutex: %s\n", strerror (err)); initialized = 1; } } @@ -96,15 +98,21 @@ initialize_module_trustlist (void) static void lock_trusttable (void) { - if (!pth_mutex_acquire (&trusttable_lock, 0, NULL)) - log_fatal ("failed to acquire mutex in %s\n", __FILE__); + int err; + + err = npth_mutex_lock (&trusttable_lock); + if (err) + log_fatal ("failed to acquire mutex in %s: %s\n", __FILE__, strerror (err)); } static void unlock_trusttable (void) { - if (!pth_mutex_release (&trusttable_lock)) - log_fatal ("failed to release mutex in %s\n", __FILE__); + int err; + + err = npth_mutex_unlock (&trusttable_lock); + if (err) + log_fatal ("failed to release mutex in %s: %s\n", __FILE__, strerror (err)); } |