[syslinux] CMENU file handling problems.
arcarlini at iee.org
arcarlini at iee.org
Mon Dec 6 15:03:40 PST 2010
H. Peter Anvin wrote:
> Sounds like some kind of file descriptor leak, indeed. The
> number 29 is particularly suspicious: 32-3 (for stdin/stdout/stderr).
I added some debug (dumping C if (__file_info[i].iop == 0 &&
__file_info[i].oop == 0), o otherwise).
ifp1 opens a file that exists but doesn't close it.
ifp2 opens a file that does not exist (and would fclose it if it
existed) 24 times.
At this stage there are 28 open files and 4 closed ones.
ifp3 opens and closes a file that exists.
At this stage there are 28 open files and 4 closed ones.
ifp2 opens and closes a file that exists.
At this stage there are 28 open files and 4 closed ones.
(There's no significance to the exists/doesn't exist sequence: that's
just what the program happened to be doing when I added the debug).
So opening a real file and closing works as expected.
fopen on a non-existent file takes up a slot in the __file_info and
fails to release it when it fails.
I tried the sneaky "perhaps I can call fclose even if fopen failed"
gambit, but it didn't go well.
I'll poke a round a bit more in a while.
Thanks
Antonio
arcarlini at iee.org
More information about the Syslinux
mailing list