Patch: file-status.diff (6 in series)
Martin Wilck
Martin.Wilck at fujitsu-siemens.com
Tue Apr 23 13:40:26 CDT 2002
Patch: file-status.diff
If errors occur in overlapped IO handlers, try to provide a more
accurate status code than STATUS_UNSUCCESSFUL.
Patch against: CVS 2002/04/23, with previous patches in series applied.
Modified files:
files: file.c
BUGS: Some error codes handled in FILE_SetDosError have no STATUS
equivalents :(
diff -ruNX ignore CVS/wine/files/file.c TMP/wine/files/file.c
--- CVS/wine/files/file.c Tue Apr 23 18:19:14 2002
+++ TMP/wine/files/file.c Tue Apr 23 18:20:07 2002
@@ -210,6 +210,42 @@
/***********************************************************************
+ * FILE_GetNtStatus(void)
+ *
+ * Retrieve the Nt Status code from errno.
+ * Try to be consistent with FILE_SetDosError().
+ */
+DWORD FILE_GetNtStatus(void)
+{
+ int err = errno;
+ DWORD nt;
+ TRACE ( "errno = %d\n", errno );
+ switch ( err )
+ {
+ case EAGAIN: nt = STATUS_SHARING_VIOLATION; break;
+ case EBADF: nt = STATUS_INVALID_HANDLE; break;
+ case ENOSPC: nt = STATUS_DISK_FULL; break;
+ case EPERM:
+ case EROFS:
+ case EACCES: nt = STATUS_ACCESS_DENIED; break;
+ case ENOENT: nt = STATUS_SHARING_VIOLATION; break;
+ case EISDIR: nt = STATUS_FILE_IS_A_DIRECTORY; break;
+ case EMFILE:
+ case ENFILE: nt = STATUS_NO_MORE_FILES; break;
+ case EINVAL:
+ case ENOTEMPTY: nt = STATUS_DIRECTORY_NOT_EMPTY; break;
+ case EPIPE: nt = STATUS_PIPE_BROKEN; break;
+ case ENOEXEC: /* ?? */
+ case ESPIPE: /* ?? */
+ case EEXIST: /* ?? */
+ default:
+ FIXME ( "Converting errno %d to STATUS_UNSUCCESSFUL\n", err );
+ nt = STATUS_UNSUCCESSFUL;
+ }
+ return nt;
+}
+
+/***********************************************************************
* FILE_SetDosError
*
* Set the DOS error code from errno.
@@ -1480,8 +1516,7 @@
/* check to see if the transfer is complete */
if(result<0)
{
- TRACE("read returned errno %d\n",errno);
- r = STATUS_UNSUCCESSFUL;
+ r = FILE_GetNtStatus ();
goto async_end;
}
@@ -1709,7 +1744,7 @@
/* check to see if the transfer is complete */
if(result<0)
{
- r = STATUS_UNSUCCESSFUL;
+ r = FILE_GetNtStatus ();
goto async_end;
}
Binary files CVS/wine/wine and TMP/wine/wine differ
More information about the wine-patches
mailing list