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 /dirmngr/certcache.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 'dirmngr/certcache.c')
-rw-r--r-- | dirmngr/certcache.c | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/dirmngr/certcache.c b/dirmngr/certcache.c index a8b84e6e3..73916b03e 100644 --- a/dirmngr/certcache.c +++ b/dirmngr/certcache.c @@ -25,7 +25,7 @@ #include <assert.h> #include <sys/types.h> #include <dirent.h> -#include <pth.h> +#include <npth.h> #include "dirmngr.h" #include "misc.h" @@ -80,10 +80,10 @@ static cert_item_t cert_cache[256]; /* This is the global cache_lock variable. In general looking is not needed but it would take extra efforts to make sure that no - indirect use of pth functions is done, so we simply lock it always. - Note: We can't use static initialization, as that is not available - through w32-pth. */ -static pth_rwlock_t cert_cache_lock; + indirect use of npth functions is done, so we simply lock it + always. Note: We can't use static initialization, as that is not + available through w32-pth. */ +static npth_rwlock_t cert_cache_lock; /* Flag to track whether the cache has been initialized. */ static int initialization_done; @@ -99,33 +99,45 @@ static unsigned int total_extra_certificates; static void init_cache_lock (void) { - if (!pth_rwlock_init (&cert_cache_lock)) + int err; + + err = npth_rwlock_init (&cert_cache_lock, NULL); + if (err) log_fatal (_("can't initialize certificate cache lock: %s\n"), - strerror (errno)); + strerror (err)); } static void acquire_cache_read_lock (void) { - if (!pth_rwlock_acquire (&cert_cache_lock, PTH_RWLOCK_RD, FALSE, NULL)) + int err; + + err = npth_rwlock_rdlock (&cert_cache_lock); + if (err) log_fatal (_("can't acquire read lock on the certificate cache: %s\n"), - strerror (errno)); + strerror (err)); } static void acquire_cache_write_lock (void) { - if (!pth_rwlock_acquire (&cert_cache_lock, PTH_RWLOCK_RW, FALSE, NULL)) + int err; + + err = npth_rwlock_wrlock (&cert_cache_lock); + if (err) log_fatal (_("can't acquire write lock on the certificate cache: %s\n"), - strerror (errno)); + strerror (err)); } static void release_cache_lock (void) { - if (!pth_rwlock_release (&cert_cache_lock)) + int err; + + err = npth_rwlock_unlock (&cert_cache_lock); + if (err) log_fatal (_("can't release lock on the certificate cache: %s\n"), - strerror (errno)); + strerror (err)); } |