- status: open --> accepted
- assigned_to: Bernd Löhr
Don't check for a socket error by using the comparison < 0 in common or windows code. It is not working under windows where a socket is of a unsigned data type.
From Microsoft doc:
"Because the SOCKET type is unsigned, compiling existing source code from, for example, a UNIX environment may lead to compiler warnings about signed/unsigned data type mismatches.
This means, for example, that checking for errors when the socket and accept functions return should not be done by comparing the return value with –1, or seeing if the value is negative (both common and legal approaches in UNIX). Instead, an application should use the manifest constant INVALID_SOCKET as defined in the Winsock2.hheader file."
I have found two places where this is a problem.
Revision 2080
vos\windows\vos_sock.c line 1413
common\trdp_mdcom.c line 2704
Suggested solution:
Compare socket with VOS_INVALID_SOCKET