[ECOS] sscanf() exception issue of C lib

Jonathan Larmour jifl@eCosCentric.com
Thu Jan 15 03:34:00 GMT 2009

Xiaochen Zhou wrote:
> Xiaochen Zhou дµÀ:
>>Jonathan Larmour дµÀ:
>>>Xiaochen Zhou wrote:
>>>>I try hard to check my code, but does not work. At last I browse the c
>>>>lib code, and have some doubts with the
>>I write a test thread to call sscanf() again and again in a loop, and in
>>the same time, I hit the F5 to flush the web pages of my device very
>>quickly (httpd has higher priority and call stdio lib's fdopen() and
>>close()). The exception repeated in few minutes. So I'm sure it is a
>>ecos lib c bug. Add the lock, after several hours testing, the exception
>>is gone. But it is not the exact evidence. I will add some testing code
>>to prove it today.
> Proved!!!

Yes, that does appear to confirm it. Thanks for tracking this down. Now
that I've looked more closely at this code, it's obvious really that the
files table should have been protected - that's the whole point of having
a mutex for it, so it was just an oversight that it wasn't - that's lasted
nearly 9 years!

Let me know if there are any problems with the attached patch, which I'm
checking in. Thanks.

eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["The best things in life aren't things."]------      Opinions==mine

Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list