[Mono-devel-list] [PATCH] Bug 74586 (and other oddities with the beta)

Bill Middleton flashdict at gmail.com
Wed Apr 13 17:57:49 EDT 2005

This patch fixes a gnarly little bug with the new io-layer, and it's
interaction with metadata/file-io.c.  The problem is that FindNextFile()
in io-layer/io.c doesn't set the cFileName at all in the WapiFindData struct,
if there aren't any files to look at - either an empty directory, or an
unmatched pattern.  (num==0)  When this happens, metadata/file-io.c happily
calls FindNextFile again, which then calls the utf16 conversion routine on the
uninitialized gunichar2 string, giving a bizarre result.  (???????????????)

This patch fixes the problem.  It also fixes bug 74586, at least insofar as
avoiding an eventual crash, and allowing the recursive directory listing code
to go as deep as you please.  The warnings from the handle not found will
eventually go away, according to what Dick told me.

Details follow.


Bug  74586
Index: mono/io-layer/io.c
- If there aren't any files in a given directory, or for a given pattern,
then nully the first element of the cFileName, so that file-io.c won't send
a null off null string to FindNextFile again.

Index: mono/metadata/file-io.c
- Test for null as the first element of cFileName.  If not null, then convert
the to string for good measure, and then check for the next file, otherwise,
set r=FALSE, and return.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.txt
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050413/3a04417a/attachment.txt 

More information about the Mono-devel-list mailing list