William A. Rowe, Jr. wrote:

wrowe       02/02/11 16:07:34

Modified:    file_io/win32 open.c
Log:
  I don't trust that the OS is even returning an error - if the handle
  is an invalid handle - I'm not certain that's an error.  Certainly
  this code is safer - merits pushing into .32


     if (file_handle == INVALID_HANDLE_VALUE)
-        return apr_get_os_error();
+        return APR_EINVAL;

From MSDN:

   Return Values
   If the function succeeds, the return value is a handle to the
   specified device.

   If the function fails, the return value is the INVALID_HANDLE_VALUE
   flag. To get extended error information, call GetLastError.


That would be fine if we were matching to INVALID_HANDLE_VALUE. We are discovering NULL rather than (DWORD)-1. This patch is not yet complete, at that, since we aren't testing for the NULL case. I'll be fixing in a moment.

If you get NULL back in this case, that means the standard handle isn't defined. It does not mean that GetStdHandle failed. Those two situations are different.

--
Brane Äibej   <[EMAIL PROTECTED]>   http://www.xbc.nu/brane/





Reply via email to