mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-17 08:56:42 -05:00
core-util: fall back to sysconf(_SC_OPEN_MAX) to find maximum file descriptor
This commit is contained in:
parent
ce3fbb5268
commit
e2aba1521a
1 changed files with 6 additions and 4 deletions
|
|
@ -2235,7 +2235,7 @@ int pa_close_all(int except_fd, ...) {
|
||||||
|
|
||||||
int pa_close_allv(const int except_fds[]) {
|
int pa_close_allv(const int except_fds[]) {
|
||||||
struct rlimit rl;
|
struct rlimit rl;
|
||||||
int fd;
|
int maxfd, fd;
|
||||||
int saved_errno;
|
int saved_errno;
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
|
@ -2302,10 +2302,12 @@ int pa_close_allv(const int except_fds[]) {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (getrlimit(RLIMIT_NOFILE, &rl) < 0)
|
if (getrlimit(RLIMIT_NOFILE, &rl) >= 0)
|
||||||
return -1;
|
maxfd = (int) rl.rlim_max;
|
||||||
|
else
|
||||||
|
maxfd = sysconf(_SC_OPEN_MAX);
|
||||||
|
|
||||||
for (fd = 3; fd < (int) rl.rlim_max; fd++) {
|
for (fd = 3; fd < maxfd; fd++) {
|
||||||
int i;
|
int i;
|
||||||
pa_bool_t found;
|
pa_bool_t found;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue