mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
fix pa_close_all() to make it actually work as advertised
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2464 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
0a2b6dd38f
commit
3c7a7952b2
1 changed files with 20 additions and 11 deletions
|
|
@ -1774,10 +1774,11 @@ int pa_close_all(int except_fd, ...) {
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
if (except_fd >= 0) {
|
if (except_fd >= 0) {
|
||||||
|
int fd;
|
||||||
p[i++] = except_fd;
|
p[i++] = except_fd;
|
||||||
|
|
||||||
while ((p[i++] = va_arg(ap, int)) >= 0)
|
while ((fd = va_arg(ap, int)) >= 0)
|
||||||
;
|
p[i++] = fd;
|
||||||
}
|
}
|
||||||
p[i] = -1;
|
p[i] = -1;
|
||||||
|
|
||||||
|
|
@ -1803,6 +1804,7 @@ int pa_close_allv(const int except_fds[]) {
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
|
|
||||||
while ((de = readdir(d))) {
|
while ((de = readdir(d))) {
|
||||||
|
pa_bool_t found;
|
||||||
long l;
|
long l;
|
||||||
char *e = NULL;
|
char *e = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -1826,17 +1828,23 @@ int pa_close_allv(const int except_fds[]) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fd <= 3)
|
if (fd < 3)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (fd == dirfd(d))
|
if (fd == dirfd(d))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
found = FALSE;
|
||||||
for (i = 0; except_fds[i] >= 0; i++)
|
for (i = 0; except_fds[i] >= 0; i++)
|
||||||
if (except_fds[i] == fd)
|
if (except_fds[i] == fd) {
|
||||||
continue;
|
found = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (close(fd) < 0) {
|
if (found)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (pa_close(fd) < 0) {
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
closedir(d);
|
closedir(d);
|
||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
|
|
@ -1890,10 +1898,11 @@ int pa_unblock_sigs(int except, ...) {
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
if (except >= 1) {
|
if (except >= 1) {
|
||||||
|
int sig;
|
||||||
p[i++] = except;
|
p[i++] = except;
|
||||||
|
|
||||||
while ((p[i++] = va_arg(ap, int)) >= 0)
|
while ((sig = va_arg(ap, int)) >= 0)
|
||||||
;
|
p[i++] = sig;
|
||||||
}
|
}
|
||||||
p[i] = -1;
|
p[i] = -1;
|
||||||
|
|
||||||
|
|
@ -1957,12 +1966,12 @@ int pa_reset_sigsv(const int except[]) {
|
||||||
int sig;
|
int sig;
|
||||||
|
|
||||||
for (sig = 1; sig < _NSIG; sig++) {
|
for (sig = 1; sig < _NSIG; sig++) {
|
||||||
int reset = 1;
|
pa_bool_t reset = TRUE;
|
||||||
|
|
||||||
switch (sig) {
|
switch (sig) {
|
||||||
case SIGKILL:
|
case SIGKILL:
|
||||||
case SIGSTOP:
|
case SIGSTOP:
|
||||||
reset = 0;
|
reset = FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
|
|
@ -1970,7 +1979,7 @@ int pa_reset_sigsv(const int except[]) {
|
||||||
|
|
||||||
for (i = 0; except[i] > 0; i++) {
|
for (i = 0; except[i] > 0; i++) {
|
||||||
if (sig == except[i]) {
|
if (sig == except[i]) {
|
||||||
reset = 0;
|
reset = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue