[syslinux] CMENU file handling problems.

arcarlini at iee.org arcarlini at iee.org
Sun Dec 5 15:23:30 PST 2010

I'm writing something that's based on Murali Krishnan Ganapathy's CMENU
except mine's driven by a menu.txt file that I supply (mostly so I can
edit the
menu.txt wherever I happen to be and so I won't need a syslinux build
everytime the menu structure changes).

I'm able to build up menus that do what I expect, so that's good.

However, I want to be able to grey out menus (mark them INACTIVE) or
hide them
altogether (mark them INVISIBLE). I want to do this based on the
presence or
absence of a file (or maybe files). So, for example, if I don't include
on today's DVD, then /SLAX/boot/initrd.gz will not exist, so I might
to write menu.txt so as to hide that option.

In my original testing the feature worked. With a more complete
the feature fails.

Poking around a bit further it seems that after ~29 attempts like this:

FILE* ifp;
const char* fname = "/some/file/that/does/NOT/exist";

if ((ifp = fopen(fname, "r")) == 0) {
  // code for failure
} else {
  // code for success

then a simple fopen(name, "r") of a file that *does* exist fails,
even though that exact same fopen will succeed if I try it before
the ~29 fopen()s on a file that foes not exist.

If I change the deliberatly failing pathname to one that succeeds, then
there seems to be no problem.

So it looks like I've hit a bug. Possibly the file descriptor table
is not cleared when a file is closed or maybe older entries do not get
reused even though they are free?

Is this a known issue? (I'd go hunting but I'm not sure where in that
the relevant code lives).

Opening a file is just a simple proxy for determining its existence: if
an alternative way (that will work for ~150 files) then I'm happy to

This is all under syslinux 4.03 and the C32 build environment is Ubuntu


Antonio Carlini
arcarlini at iee.org

More information about the Syslinux mailing list