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.
This commit is contained in:
committed by
Martin Willi
parent
12a230ddb4
commit
dece3d8efc
@@ -793,9 +793,10 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level,
|
|||||||
fclose(fd);
|
fclose(fd);
|
||||||
src = chunk;
|
src = chunk;
|
||||||
|
|
||||||
this->lock->write_lock(this->lock);
|
|
||||||
if (level == 0)
|
if (level == 0)
|
||||||
{
|
{
|
||||||
|
this->lock->write_lock(this->lock);
|
||||||
|
|
||||||
/* flush secrets on non-recursive invocation */
|
/* flush secrets on non-recursive invocation */
|
||||||
while (this->shared->remove_last(this->shared,
|
while (this->shared->remove_last(this->shared,
|
||||||
(void**)&shared) == SUCCESS)
|
(void**)&shared) == SUCCESS)
|
||||||
@@ -1106,7 +1107,10 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
error:
|
error:
|
||||||
this->lock->unlock(this->lock);
|
if (level == 0)
|
||||||
|
{
|
||||||
|
this->lock->unlock(this->lock);
|
||||||
|
}
|
||||||
chunk_clear(&chunk);
|
chunk_clear(&chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user