diff options
author | Lennart Poettering <lennart@poettering.net> | 2008-07-29 15:36:00 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2008-07-29 15:36:00 +0200 |
commit | 68ae1d4d00bea671d2244248b3566ceba646c483 (patch) | |
tree | c82494b829087692753974e37e5f02493954cf79 /src/pulsecore/core-util.c | |
parent | e3fb086681bf743310f2af19bf9a01957fd34782 (diff) |
fix two thinkos in signal reset/close_all code
Diffstat (limited to 'src/pulsecore/core-util.c')
-rw-r--r-- | src/pulsecore/core-util.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index d259fb16..c8dc7e5f 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -1887,17 +1887,21 @@ int pa_close_allv(const int except_fds[]) { if (getrlimit(RLIMIT_NOFILE, &rl) < 0) return -1; - for (fd = 0; fd < (int) rl.rlim_max; fd++) { + for (fd = 3; fd < (int) rl.rlim_max; fd++) { int i; + pa_bool_t found; - if (fd <= 3) - continue; - + found = FALSE; for (i = 0; except_fds[i] >= 0; i++) - if (except_fds[i] == fd) - continue; + if (except_fds[i] == fd) { + found = TRUE; + break; + } - if (close(fd) < 0 && errno != EBADF) + if (found) + continue; + + if (pa_close(fd) < 0 && errno != EBADF) return -1; } @@ -1972,10 +1976,11 @@ int pa_reset_sigs(int except, ...) { i = 0; if (except >= 1) { + int sig; p[i++] = except; - while ((p[i++] = va_arg(ap, int)) >= 0) - ; + while ((sig = va_arg(ap, int)) >= 0) + sig = p[i++]; } p[i] = -1; |