mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 11:43:31 +00:00
CLIENT_WaitReply: don't clear last error on success; fixed callers
accordingly (based on a patch by Juergen Schmied).
This commit is contained in:
parent
32452a4683
commit
3f09ec5263
7 changed files with 10 additions and 3 deletions
|
@ -344,6 +344,7 @@ HFILE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing,
|
|||
CLIENT_SendRequest( REQ_CREATE_FILE, -1, 2,
|
||||
&req, sizeof(req),
|
||||
filename, strlen(filename) + 1 );
|
||||
SetLastError(0);
|
||||
CLIENT_WaitSimpleReply( &reply, sizeof(reply), NULL );
|
||||
|
||||
/* If write access failed, retry without GENERIC_WRITE */
|
||||
|
@ -359,6 +360,7 @@ HFILE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing,
|
|||
CLIENT_SendRequest( REQ_CREATE_FILE, -1, 2,
|
||||
&req, sizeof(req),
|
||||
filename, strlen(filename) + 1 );
|
||||
SetLastError(0);
|
||||
CLIENT_WaitSimpleReply( &reply, sizeof(reply), NULL );
|
||||
}
|
||||
}
|
||||
|
@ -380,6 +382,7 @@ HFILE FILE_CreateDevice( int client_id, DWORD access, LPSECURITY_ATTRIBUTES sa )
|
|||
req.inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
|
||||
req.id = client_id;
|
||||
CLIENT_SendRequest( REQ_CREATE_DEVICE, -1, 1, &req, sizeof(req) );
|
||||
SetLastError(0);
|
||||
CLIENT_WaitSimpleReply( &reply, sizeof(reply), NULL );
|
||||
return reply.handle;
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ static unsigned int CLIENT_WaitReply_v( int *len, int *passed_fd,
|
|||
remaining -= addlen;
|
||||
}
|
||||
|
||||
SetLastError( head.type );
|
||||
if (head.type) SetLastError( head.type );
|
||||
return head.type; /* error code */
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ HANDLE WINAPI CreateEventA( SECURITY_ATTRIBUTES *sa, BOOL manual_reset,
|
|||
req.initial_state = initial_state;
|
||||
req.inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
|
||||
CLIENT_SendRequest( REQ_CREATE_EVENT, -1, 2, &req, sizeof(req), name, len );
|
||||
SetLastError(0);
|
||||
CLIENT_WaitSimpleReply( &reply, sizeof(reply), NULL );
|
||||
if (reply.handle == -1) return 0;
|
||||
return reply.handle;
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
/***********************************************************************
|
||||
* CreateMutex32A (KERNEL32.166)
|
||||
*/
|
||||
HANDLE WINAPI CreateMutexA( SECURITY_ATTRIBUTES *sa, BOOL owner,
|
||||
LPCSTR name )
|
||||
HANDLE WINAPI CreateMutexA( SECURITY_ATTRIBUTES *sa, BOOL owner, LPCSTR name )
|
||||
{
|
||||
struct create_mutex_request req;
|
||||
struct create_mutex_reply reply;
|
||||
|
@ -25,6 +24,7 @@ HANDLE WINAPI CreateMutexA( SECURITY_ATTRIBUTES *sa, BOOL owner,
|
|||
req.owned = owner;
|
||||
req.inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
|
||||
CLIENT_SendRequest( REQ_CREATE_MUTEX, -1, 2, &req, sizeof(req), name, len );
|
||||
SetLastError(0);
|
||||
CLIENT_WaitSimpleReply( &reply, sizeof(reply), NULL );
|
||||
if (reply.handle == -1) return 0;
|
||||
return reply.handle;
|
||||
|
|
|
@ -35,6 +35,7 @@ HANDLE WINAPI CreateSemaphoreA( SECURITY_ATTRIBUTES *sa, LONG initial,
|
|||
req.inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
|
||||
|
||||
CLIENT_SendRequest( REQ_CREATE_SEMAPHORE, -1, 2, &req, sizeof(req), name, len );
|
||||
SetLastError(0);
|
||||
CLIENT_WaitSimpleReply( &reply, sizeof(reply), NULL );
|
||||
if (reply.handle == -1) return 0;
|
||||
return reply.handle;
|
||||
|
|
|
@ -140,6 +140,7 @@ struct object *create_file( int fd, const char *name, unsigned int access,
|
|||
case GENERIC_READ|GENERIC_WRITE: flags |= O_RDWR; break;
|
||||
}
|
||||
|
||||
/* FIXME: should set error to ERROR_ALREADY_EXISTS if file existed before */
|
||||
if ((fd = open( name, flags | O_NONBLOCK,
|
||||
(attrs & FILE_ATTRIBUTE_READONLY) ? 0444 : 0666 )) == -1)
|
||||
{
|
||||
|
|
|
@ -444,6 +444,7 @@ HANDLE CONSOLE_OpenHandle( BOOL output, DWORD access, LPSECURITY_ATTRIBUTES sa )
|
|||
req.access = access;
|
||||
req.inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
|
||||
CLIENT_SendRequest( REQ_OPEN_CONSOLE, -1, 1, &req, sizeof(req) );
|
||||
SetLastError(0);
|
||||
CLIENT_WaitSimpleReply( &reply, sizeof(reply), NULL );
|
||||
return reply.handle;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue