diff --git a/files/file.c b/files/file.c index 4ec9a405ca5..05166e3b9b2 100644 --- a/files/file.c +++ b/files/file.c @@ -219,8 +219,8 @@ int FILE_GetUnixHandleType( HANDLE handle, DWORD access, DWORD *type ) if (!(ret = SERVER_CALL_ERR())) { fd = req->fd; - if (type) *type = req->type; } + if (type) *type = req->type; } SERVER_END_REQ; if (ret) return -1; @@ -1378,7 +1378,7 @@ static BOOL FILE_ReadFileEx(HANDLE hFile, LPVOID buffer, DWORD bytesToRead, return FALSE; } - fd = FILE_GetUnixHandle( hFile, GENERIC_WRITE ); + fd = FILE_GetUnixHandle( hFile, GENERIC_READ ); if(fd<0) { TRACE("Couldn't get FD\n"); diff --git a/server/file.c b/server/file.c index c79efa68bd6..a9725766cf7 100644 --- a/server/file.c +++ b/server/file.c @@ -495,6 +495,7 @@ DECL_HANDLER(get_handle_fd) struct object *obj; req->fd = -1; + req->type = FD_TYPE_INVALID; if ((obj = get_handle_obj( current->process, req->handle, req->access, NULL ))) { int fd = get_handle_fd( current->process, req->handle, req->access );