Make sure SDL file descriptors don't leak into child processes

This commit is contained in:
Sam Lantinga 2021-09-08 14:47:40 -07:00
parent 3ed8ba7d33
commit bf97c5a22f
15 changed files with 24 additions and 24 deletions

View file

@ -725,7 +725,7 @@ SDL_EVDEV_device_added(const char *dev_path, int udev_class)
return SDL_OutOfMemory();
}
item->fd = open(dev_path, O_RDONLY | O_NONBLOCK);
item->fd = open(dev_path, O_RDONLY | O_NONBLOCK | O_CLOEXEC);
if (item->fd < 0) {
SDL_free(item);
return SDL_SetError("Unable to open %s", dev_path);