mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-11-20 09:06:24 +00:00
Make sure SDL file descriptors don't leak into child processes
This commit is contained in:
@@ -416,7 +416,7 @@ static SDL_WSCONS_input_data* SDL_WSCONS_Init_Keyboard(const char* dev)
|
||||
if (!input) {
|
||||
return input;
|
||||
}
|
||||
input->fd = open(dev,O_RDWR | O_NONBLOCK);
|
||||
input->fd = open(dev,O_RDWR | O_NONBLOCK | O_CLOEXEC);
|
||||
if (input->fd == -1) {
|
||||
free(input);
|
||||
input = NULL;
|
||||
|
||||
@@ -43,7 +43,7 @@ SDL_WSCONS_mouse_input_data* SDL_WSCONS_Init_Mouse()
|
||||
SDL_WSCONS_mouse_input_data* mouseInputData = SDL_calloc(1, sizeof(SDL_WSCONS_mouse_input_data));
|
||||
|
||||
if (!mouseInputData) return NULL;
|
||||
mouseInputData->fd = open("/dev/wsmouse",O_RDWR | O_NONBLOCK);
|
||||
mouseInputData->fd = open("/dev/wsmouse",O_RDWR | O_NONBLOCK | O_CLOEXEC);
|
||||
if (mouseInputData->fd == -1) {free(mouseInputData); return NULL; }
|
||||
#ifdef WSMOUSEIO_SETMODE
|
||||
ioctl(mouseInputData->fd, WSMOUSEIO_SETMODE, WSMOUSE_COMPAT);
|
||||
|
||||
Reference in New Issue
Block a user