summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/core-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-07-31 23:34:09 +0300
committerLennart Poettering <lennart@poettering.net>2008-07-31 23:34:09 +0300
commitd757dc7ff47a47d760cc5959579b010fb5a8b214 (patch)
treefbf258c55e7da38c66b2585542f241bb473d7ab7 /src/pulsecore/core-util.c
parent297267b9c4e297cc1c26dbc1e6d0be476443f128 (diff)
parent80428d80b03b3c26bd25169fa4083e16cf6bfafc (diff)
Merge branch 'master' of ssh://rootserver/home/lennart/git/public/pulseaudio
Diffstat (limited to 'src/pulsecore/core-util.c')
-rw-r--r--src/pulsecore/core-util.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index d259fb16..c4818e39 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -177,7 +177,7 @@ int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
#else
{
mode_t u;
- u = umask(~m);
+ u = umask((~m) & 0777);
r = mkdir(dir, m);
umask(u);
}
@@ -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;