agent: Fix deadlock in trustlist due to the switch to npth.
authorWerner Koch <wk@gnupg.org>
Mon, 30 Apr 2012 12:37:36 +0000 (14:37 +0200)
committerWerner Koch <wk@gnupg.org>
Mon, 30 Apr 2012 12:37:36 +0000 (14:37 +0200)
commit0f02fba19df16c82ca1ad44a8cb09f952d755598
treec07c5b608cbd6e441b3e91c66ffb4054151565bc
parent8d7522837c6dba3065d24594bcdbe7b99a702cde
agent: Fix deadlock in trustlist due to the switch to npth.

* agent/trustlist.c (clear_trusttable): New.
(agent_reload_trustlist): Use new function.
(read_trustfiles): Require to be called with lock held.
(agent_istrusted): Factor all code out to ...
(istrusted_internal): new.  Add ALREADY_LOCKED arg.  Make sure the
table islocked.  Do not print TRUSTLISTFLAG stati if called internally.
(agent_marktrusted): Replace calls to agent_reload_trustlist by
explicit code.
--

In contrast to pth, npth does not use recursive mutexes by default.
However, the code in trustlist.c assumed recursive locks and thus we
had to rework it.
agent/trustlist.c