Found an interesting bug in libsoup on Windows



Fixed now in trunk:

2008-06-04  Tor Lillqvist  <tml novell com>

	* libsoup/soup-socket.c (set_fdflags): The SO_RCVTIMEO and
	SO_SNDTIMEO options to setsockopt() take int values, in
	milliseconds, on Windows. Not struct timeval. Eek. So passing a
	struct timeval meant that the tv_sec value (which is first in the
	struct) is interpreted as milliseconds. setsockopt apparently
	doesn't even get upset by the fact that the option size doesn't
	match the sizeof(int) it should expect.

One wonders what the Winsock designers were thinking when they reused
the same socket option names SO_RCVTIMEO and SO_SNDTIMEO, but changed
the type of the option value. Luckily I didn't find any other use of
SO_RCVTIMEO and SO_SNDTIMEO in the part of the GNOME stack that has
been ported to Windows. But if you happen to have some other source
code ported from Unix to Windows, it is a good idea to look for these
options and verify that they are used correctly.

--tml


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