aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarius Tomaschewski <mt@suse.de>2009-09-02 13:49:39 +0200
committerMartin Willi <martin@strongswan.org>2009-09-03 14:46:36 +0200
commitdece3d8efcde37d8e2470f10e9d8fd6613aff9de (patch)
treeba2bdd71eed2b6ab609c7aefaa86df8ab4814376 /src
parent12a230ddb4d9396cf551e1c7b5e24bf4eb334d4c (diff)
downloadstrongswan-dece3d8efcde37d8e2470f10e9d8fd6613aff9de.tar.bz2
strongswan-dece3d8efcde37d8e2470f10e9d8fd6613aff9de.tar.xz
Fixed load_secrets to acquire/release lock in level 0 only
The write_lock call fails with EDEADLK and unlocks in the next recursion level.
Diffstat (limited to 'src')
-rw-r--r--src/charon/plugins/stroke/stroke_cred.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/charon/plugins/stroke/stroke_cred.c b/src/charon/plugins/stroke/stroke_cred.c
index f878180e9..e34613efd 100644
--- a/src/charon/plugins/stroke/stroke_cred.c
+++ b/src/charon/plugins/stroke/stroke_cred.c
@@ -793,9 +793,10 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level,
fclose(fd);
src = chunk;
- this->lock->write_lock(this->lock);
if (level == 0)
{
+ this->lock->write_lock(this->lock);
+
/* flush secrets on non-recursive invocation */
while (this->shared->remove_last(this->shared,
(void**)&shared) == SUCCESS)
@@ -1106,7 +1107,10 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level,
}
}
error:
- this->lock->unlock(this->lock);
+ if (level == 0)
+ {
+ this->lock->unlock(this->lock);
+ }
chunk_clear(&chunk);
}