mirror of
https://github.com/FeralInteractive/gamemode.git
synced 2025-06-06 15:47:20 +02:00
Align open_fdinfo_dir with pidfds_to_pids
The function `pidfds_to_pids` expected `-1` if `open_fdinfo_dir` failed but the latter returned `errno` which is hard to distinguish from a valid file handle. Correct that by making `open_fdinfo_dir` a wrapper around `open`.
This commit is contained in:
parent
510a0a6ae2
commit
3fcff0d75f
@ -196,12 +196,5 @@ int pidfds_to_pids(int *fds, pid_t *pids, int count)
|
|||||||
/* misc directory helpers */
|
/* misc directory helpers */
|
||||||
int open_fdinfo_dir(void)
|
int open_fdinfo_dir(void)
|
||||||
{
|
{
|
||||||
int fd;
|
return open("/proc/self/fdinfo", O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC | O_NOCTTY);
|
||||||
|
|
||||||
fd = open("/proc/self/fdinfo", O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC | O_NOCTTY);
|
|
||||||
|
|
||||||
if (fd == -1)
|
|
||||||
return errno;
|
|
||||||
|
|
||||||
return fd;
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user