Bug #28775 errno or socket_errno in viosocket.c on windows ?
Submitted: 30 May 2007 12:33 Modified: 5 Oct 2012 16:27
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version:5.0 OS:Windows
Assigned to: Assigned Account CPU Architecture:Any
Tags: debug, socket, tcp, trace

[30 May 2007 12:33] Shane Bester
Description:
in vio_read function in vio_socket.c, an error is printed to debug trace like this;

#ifndef DBUG_OFF
  if (r < 0)
  {
    DBUG_PRINT("vio_error", ("Got error %d during read",errno));
  }
#endif /* DBUG_OFF */

when debugging some timeout problems on windows, I found this exact message to be giving useless error code back.

How to repeat:
Look at the source code of the other functions in that file..

Suggested fix:
http://msdn2.microsoft.com/en-us/library/ms741580.aspx

I think it should print value socket_errno which maps to WSAGetLastError() on windows.
[10 Oct 2008 21:35] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/56062

2728 Ignacio Galarza	2008-10-10
      Bug#28775 - errno or socket_errno in viosocket.c on windows
      - Use socket_errno on Win32. It is mapped to WSAGetLastError().
[16 Jan 2009 19:20] Jim Winstead
there is something wrong with our code review policy when we can't trust a developer to just push a change like this in a debugging statement.
[18 Feb 2009 19:39] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/66796

3025 Ignacio Galarza	2009-02-18
      Bug#28775 - errno or socket_errno in viosocket.c on windows
      - Use socket_errno on Win32. It is mapped to WSAGetLastError().
[16 Nov 2010 13:24] MySQL Verification Team
*bump*
[5 Oct 2012 16:27] Paul DuBois
Noted in 5.6.8 changelog. 

In debug builds, vio_read() printed errno rather than socket_error to 
the debug trace.