From 65e7bc18a9a7b89e55b87a74ae47d45269b51847 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 30 Oct 2009 03:32:38 +0100 Subject: use cloexec wrappers wherever applicable --- src/pulsecore/authkey.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/pulsecore/authkey.c') diff --git a/src/pulsecore/authkey.c b/src/pulsecore/authkey.c index 15613e27..d671e367 100644 --- a/src/pulsecore/authkey.c +++ b/src/pulsecore/authkey.c @@ -70,10 +70,6 @@ static int generate(int fd, void *ret_data, size_t length) { #define O_BINARY 0 #endif -#ifndef O_NOCTTY -#define O_NOCTTY 0 -#endif - /* Load an euthorization cookie from file fn and store it in data. If * the cookie file doesn't exist, create it */ static int load(const char *fn, void *data, size_t length) { @@ -86,9 +82,9 @@ static int load(const char *fn, void *data, size_t length) { pa_assert(data); pa_assert(length > 0); - if ((fd = open(fn, O_RDWR|O_CREAT|O_BINARY|O_NOCTTY, S_IRUSR|S_IWUSR)) < 0) { + if ((fd = pa_open_cloexec(fn, O_RDWR|O_CREAT|O_BINARY, S_IRUSR|S_IWUSR)) < 0) { - if (errno != EACCES || (fd = open(fn, O_RDONLY|O_BINARY|O_NOCTTY)) < 0) { + if (errno != EACCES || (fd = open(fn, O_RDONLY|O_BINARY)) < 0) { pa_log_warn("Failed to open cookie file '%s': %s", fn, pa_cstrerror(errno)); goto finish; } else @@ -204,7 +200,7 @@ int pa_authkey_save(const char *fn, const void *data, size_t length) { if (!(p = normalize_path(fn))) return -2; - if ((fd = open(p, O_RDWR|O_CREAT|O_NOCTTY, S_IRUSR|S_IWUSR)) < 0) { + if ((fd = pa_open_cloexec(p, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR)) < 0) { pa_log_warn("Failed to open cookie file '%s': %s", fn, pa_cstrerror(errno)); goto finish; } -- cgit