Hi, excuse me, if I am posting this for second
time
I would like to inform you about a bug, I found
in the glib library. The
bug occurs under Win32 when the function 'readdir' is used. The code for that function looks as follows: struct dirent*
gwin_readdir (DIR *dir) { static struct dirent result; .
. Here the d_name part of dirent structure is changed . return &result; } Obviously this code is not thread safe, even
more - an error could be aroused
in single threaded applications. For example, if you open a directory and in the middle of your 'dirent' tracing you open and trace another directory, after tracing of the second directory your 'd_name' member is filled with the name of the last entry in the second directory! That means it is invalid before a new 'readdit' call. That's the problem. The solution is very simple
- just add an 'dirent' member
to 'DIR' structure. PS: ANOTHER!!!
I tried to compile the glib-1.2.3 using Visul C++ and it stops with a error C2018 on file utils.h. After a while I found the following lines in config.h ( config.h.w32 ): #define GLIB_MAJOR_VERSION
@GLIB_MAJOR_VERSION@
#define GLIB_MINOR_VERSION @GLIB_MINOR_VERSION@ #define GLIB_MICRO_VERSION @GLIB_MICRO_VERSION@ #define GLIB_INTERFACE_AGE @GLIB_INTERFACE_AGE@ #define GLIB_BINARY_AGE @GLIB_BINARY_AGE@ What are that macroses for??? Do you believe you
use them :)
The problem is by the compilation of utils.h, because only it uses the macroses GLIB_INTERFACE_AGE and GLIB_BINARY_AGE. The others are overwritten because they are defined both in config.h and glib.h and glib.h is included after config.h. I am supplying the files that must be
updated.
Do you Must write a code that generates so many
warnings?
|