Mail Archives: djgpp/1998/05/25/08:16:11
I found that constant MAXFILE defined in dir.h is equal 9 which means
that buffer for file name generated by fnsplit() must be at least 8
symbols length. But DJGPP's libc support long file names (LFN) up to
260 symbols length and in such case buffer must be greater than 8
symbols to proper file name handling. It means that every time when
fnsplit() proceed with file name longer than 8 symbols the result will
be undefined. Of course, it needs switch options LFN in DJGPP.ENV to y
(+LFN=y).
So, the following example will crash when the file name (i.e. its NAME
part without DRIVE, DIRECTORY and EXTENSION) longer than 8 symbols:
(code taken from libc.info)
char d[MAXDRIVE], p[MAXDIR], f[MAXFILE], e[MAXEXT];
int which = fnsplit("d:/Program Files/foo/Long file Name BAR.extention", d, p, f, e);
d = "d:"
p = "/Program Files/foo/"
f = "Long fil" <<<<- fnsplit() with LFN=y must have another behavior, isn't it?
e = ".exe"
There is a correction for this "bug": simply don't use MAXFILE
constant and declare buffer for extracted file name large, for example
like MAXDIR.
Sincerely,
Alexander Bokovoy, <bokovoy AT bspu DOT unibel DOT by>
--=== The Soft Age coming soon ===--
- Raw text -