From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26184 invoked by alias); 15 Jan 2009 03:34:37 -0000 Received: (qmail 26167 invoked by uid 22791); 15 Jan 2009 03:34:36 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_00,MIME_CHARSET_FARAWAY,SPF_PASS X-Spam-Check-By: sourceware.org Received: from hagrid.ecoscentric.com (HELO mail.ecoscentric.com) (212.13.207.197) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 15 Jan 2009 03:33:38 +0000 Received: from localhost (hagrid.ecoscentric.com [127.0.0.1]) by mail.ecoscentric.com (Postfix) with ESMTP id 54F983B40041; Thu, 15 Jan 2009 03:33:36 +0000 (GMT) Received: from mail.ecoscentric.com ([127.0.0.1]) by localhost (hagrid.ecoscentric.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4WnxevaWX5WA; Thu, 15 Jan 2009 03:33:35 +0000 (GMT) Message-ID: <496EAE96.5000200@eCosCentric.com> Date: Thu, 15 Jan 2009 03:34:00 -0000 From: Jonathan Larmour User-Agent: Mozilla Thunderbird 1.0.8-1.1.fc3.4.legacy (X11/20060515) MIME-Version: 1.0 To: Xiaochen Zhou CC: eCos discussion , eCos Patches List Subject: Re: [ECOS] sscanf() exception issue of C lib References: <496C3E08.7050400@h3c.com> <496E2221.8040505@eCosCentric.com> <496E8D30.5020501@h3c.com> <496EA5F6.1080407@h3c.com> In-Reply-To: <496EA5F6.1080407@h3c.com> Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 8bit Mailing-List: contact ecos-patches-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-patches-owner@ecos.sourceware.org X-SW-Source: 2009-01/txt/msg00009.txt.bz2 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 >>>>language/c/libc/stdio/current/src/common/fflush.cxx >>>> [snip] >>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. Jifl -- 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