Fixed file descriptor leaks.

oldstable
Alexandre Julliard 2000-04-04 19:57:23 +00:00
parent a57d77a750
commit 8a971bfec0
3 changed files with 4 additions and 9 deletions

View File

@ -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 );

View File

@ -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;
}

View File

@ -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 */