mirror of
https://github.com/encounter/SDL.git
synced 2025-12-08 13:15:10 +00:00
Make sure SDL file descriptors don't leak into child processes
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
SDL_bool
|
||||
SDL_GetPowerInfo_Haiku(SDL_PowerState * state, int *seconds, int *percent)
|
||||
{
|
||||
const int fd = open("/dev/misc/apm", O_RDONLY);
|
||||
const int fd = open("/dev/misc/apm", O_RDONLY | O_CLOEXEC);
|
||||
SDL_bool need_details = SDL_FALSE;
|
||||
uint16 regs[6];
|
||||
uint8 ac_status;
|
||||
|
||||
@@ -51,7 +51,7 @@ open_power_file(const char *base, const char *node, const char *key)
|
||||
}
|
||||
|
||||
snprintf(path, pathlen, "%s/%s/%s", base, node, key);
|
||||
return open(path, O_RDONLY);
|
||||
return open(path, O_RDONLY | O_CLOEXEC);
|
||||
}
|
||||
|
||||
|
||||
@@ -330,7 +330,7 @@ SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState * state,
|
||||
int battery_flag = 0;
|
||||
int battery_percent = 0;
|
||||
int battery_time = 0;
|
||||
const int fd = open(proc_apm_path, O_RDONLY);
|
||||
const int fd = open(proc_apm_path, O_RDONLY | O_CLOEXEC);
|
||||
char buf[128];
|
||||
char *ptr = &buf[0];
|
||||
char *str = NULL;
|
||||
|
||||
Reference in New Issue
Block a user