g_io_channel_unix_new has bug +win32



The latest release of glib (2.2.2) has a bug in the g_io_channel_unix_new method. The call to getsockopt I believe should include the optval and optlen args; currently they are NULL. The older glib 2.2.1 call used to 'sort-of' work because the call erroneously checked SO_ERROR instead of SOCKET_ERROR; the new release is now correctly checking socket_error. After installing the latest release, my code broke. When I put the getsockopt call in my code, I got a return code of -1; as expected. When I included the optval and optlen args, the call succeeded. After checking the man pages of various unix systems and windows, I noticed this tidbit:
 
The call succeeds unless:
...unix
[EFAULT] The address pointed to by optval is not in a valid part of the process address space.  For getsockopt, this error may also be returned if optlen is not in a valid part of the process address space.
...windows
WSAEFAULT
One of the optval or the optlen parameters is not a valid part of the user address space, or the optlen parameter is too small.
 
WSAEFAULT
10014

Bad address.
The system detected an invalid pointer address in attempting to use a pointer argument of a call. This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small. For instance, if the length of an argument, which is a sockaddr structure, is smaller than the sizeof(sockaddr).
I believe NULL is not a valid part of the process address space.
 
Thanks,
Bruce


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]