Fixed file descriptor leaks.
This commit is contained in:
parent
a57d77a750
commit
8a971bfec0
|
@ -5,6 +5,7 @@
|
|||
* Copyright 2000 Alexandre Julliard
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <X11/cursorfont.h>
|
||||
|
@ -169,6 +170,7 @@ static void process_attach(void)
|
|||
argv0, Options.display ? Options.display : "(none specified)" );
|
||||
ExitProcess(1);
|
||||
}
|
||||
fcntl( ConnectionNumber(display), F_SETFD, 1 ); /* set close on exec flag */
|
||||
screen = DefaultScreenOfDisplay( display );
|
||||
visual = DefaultVisual( display, DefaultScreen(display) );
|
||||
root_window = DefaultRootWindow( display );
|
||||
|
|
|
@ -309,16 +309,9 @@ void FILE_SetDosError(void)
|
|||
*/
|
||||
HFILE FILE_DupUnixHandle( int fd, DWORD access )
|
||||
{
|
||||
int unix_handle;
|
||||
struct alloc_file_handle_request *req = get_req_buffer();
|
||||
|
||||
if ((unix_handle = dup(fd)) == -1)
|
||||
{
|
||||
FILE_SetDosError();
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
req->access = access;
|
||||
server_call_fd( REQ_ALLOC_FILE_HANDLE, unix_handle, NULL );
|
||||
server_call_fd( REQ_ALLOC_FILE_HANDLE, fd, NULL );
|
||||
return req->handle;
|
||||
}
|
||||
|
||||
|
|
|
@ -390,7 +390,7 @@ int CLIENT_InitServer(void)
|
|||
if ((env_fd = getenv( "__WINE_FD" )) && isdigit(env_fd[0]))
|
||||
{
|
||||
fd = atoi( env_fd );
|
||||
if (fcntl( fd, F_GETFL, 0 ) != -1) return fd;
|
||||
if (fcntl( fd, F_SETFD, 1 ) != -1) return fd; /* set close on exec flag */
|
||||
}
|
||||
|
||||
/* retrieve the current directory */
|
||||
|
|
Loading…
Reference in New Issue