Description:
Source code shows that my_errno is not updated when global Windows functions are called, e.g. in io_file.cpp :
#ifdef __WIN__
if(m_file < MY_FILE_MIN)
bytes_written = ::write(m_file, (uchar*) buf, per_write);
else
#endif
bytes_written = my_write(m_file, buf, per_write, MYF(MY_WME));
...
LOG_WRITE(MEB_ERROR, "File_write operation failed for file %s. "
"Error code: %d, %s\n",
m_file_name, my_errno, strerror(my_errno));
^^ here my_errno will contain incorrect error code if ::write was called.
How to repeat:
May be difficult to repeat - source code review should be performed instead
Suggested fix:
Update my_err if global methods are called.
Additionally - GetLastError() is definitely required in error message
Description: Source code shows that my_errno is not updated when global Windows functions are called, e.g. in io_file.cpp : #ifdef __WIN__ if(m_file < MY_FILE_MIN) bytes_written = ::write(m_file, (uchar*) buf, per_write); else #endif bytes_written = my_write(m_file, buf, per_write, MYF(MY_WME)); ... LOG_WRITE(MEB_ERROR, "File_write operation failed for file %s. " "Error code: %d, %s\n", m_file_name, my_errno, strerror(my_errno)); ^^ here my_errno will contain incorrect error code if ::write was called. How to repeat: May be difficult to repeat - source code review should be performed instead Suggested fix: Update my_err if global methods are called. Additionally - GetLastError() is definitely required in error message