On Thu, 2008-08-28 at 19:29 -0700, Pawel Veselov wrote: > Hi, > > Was looking at the _close_r() in > src/newlib/newlib/libc/sys/wince/io.c, at the top: > > EnterCriticalSection(&critsect); > FDCHECK(fd); > > FDCHECK() macro can return from the method if file handle is invalid, > and if it does, wouldn't that leave the lock, and cause deadlock for I/O > operations?
That's a very sharp observation ! Thanks for pointing this out. > P.S. What does critsect protect there? Changes to fd[*].fd ? I'd say all of the _fdtab array. However, as you point out, in some places it's not coded very well. More browsing through that source make wonder about the quality of that code. The _read_r() function uses this same _fdtab[] but never uses the critical section. Would you be willing to submit a fix for this ? My first idea would be to add a second argument to FDCHECK which could be the statement to run before the return. Danny -- Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Cegcc-devel mailing list Cegcc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cegcc-devel