Date: Mon, 25 May 1998 15:11:10 +0200 From: Alexander Bokovoy Reply-To: Alexander Bokovoy Organization: BSPU named after Maxim Tank Message-ID: <9632.980525@bspu.unibel.by> To: djgpp AT delorie DOT com Subject: Bug in GCC 2.8.0? MAXFILE is equal 9 while LFN are supported Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk 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, --=== The Soft Age coming soon ===--