Committed as 2404 to trunk.

-Angus

On Mon, Sep 7, 2009 at 7:26 PM, Fabio M. Di Nitto<[email protected]> wrote:
> Good catch. Please commit.
>
> On Mon, 2009-09-07 at 09:20 +1200, Angus Salkeld wrote:
>> Hi
>>
>> In logsys there are a number of XYZ_unlocked() functions that are called
>> like this:
>>
>>       pthread_mutex_lock (&logsys_config_mutex);
>>
>>       XYZ_unlocked();
>>
>>       pthread_mutex_unlock (&logsys_config_mutex);
>>
>> The assumption (I assume) is that XYZ_unlocked() should not do any 
>> (un)locking.
>> But _logsys_config_subsys_get_unlocked() unlocks if it finds the subsys.
>> This means that there is 1 lock and 2 unlocks.
>
> Yes that's right, most of those _unlocked functions are called as
> helpers within other locking functions. A double lock would clearly be
> very bad.
>
>>
>> This causes a core dump in uClibc. So I have simply removed the unlock.
>>
>> Regards
>> Angus
>>
>> diff --git a/exec/logsys.c b/exec/logsys.c
>> index af72bcf..12c9e5e 100644
>> --- a/exec/logsys.c
>> +++ b/exec/logsys.c
>> @@ -803,7 +803,6 @@ static int _logsys_config_subsys_get_unlocked
>> (const char *subsys)
>>
>>         for (i = 0; i <= LOGSYS_MAX_SUBSYS_COUNT; i++) {
>>                 if (strcmp (logsys_loggers[i].subsys, subsys) == 0) {
>> -                   pthread_mutex_unlock (&logsys_config_mutex);
>>                         return i;
>>                 }
>>         }
>
> thanks for catching this.
>
> Fabio
>
>
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to