summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Meerwald <pmeerw@pmeerw.net>2014-08-13 00:30:01 +0200
committerPeter Meerwald <pmeerw@pmeerw.net>2014-08-18 15:31:31 +0200
commit454040116798da298f61ac0e8653a4806dc62aeb (patch)
treec0caee5faf5b563d9c9aa4184a1f43d2d69cac7e
parent1849cfdad92cb56f5510f46405c98caa9e6b7577 (diff)
core-util: Avoid warnings when missing certain system calls
on systems lacking #defines HAVE_ACCEPT4, HAVE_PIPE2, SOCK_CLOEXEC pulsecore/core-util.c: In function 'pa_open_cloexec': pulsecore/core-util.c:3348:1: warning: label 'finish' defined but not used [-Wunused-label] pulsecore/core-util.c: In function 'pa_socket_cloexec': pulsecore/core-util.c:3370:1: warning: label 'finish' defined but not used [-Wunused-label] pulsecore/core-util.c: In function 'pa_pipe_cloexec': pulsecore/core-util.c:3393:1: warning: label 'finish' defined but not used [-Wunused-label] pulsecore/core-util.c: In function 'pa_accept_cloexec': pulsecore/core-util.c:3415:1: warning: label 'finish' defined but not used [-Wunused-label] Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
-rw-r--r--src/pulsecore/core-util.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 1f902f40a..d7a95d6d2 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -3342,8 +3342,11 @@ int pa_open_cloexec(const char *fn, int flags, mode_t mode) {
return fd;
#endif
- if ((fd = open(fn, flags, mode)) < 0)
- return fd;
+ if ((fd = open(fn, flags, mode)) >= 0)
+ goto finish;
+
+ /* return error */
+ return fd;
finish:
/* Some implementations might simply ignore O_CLOEXEC if it is not
@@ -3364,8 +3367,11 @@ int pa_socket_cloexec(int domain, int type, int protocol) {
return fd;
#endif
- if ((fd = socket(domain, type, protocol)) < 0)
- return fd;
+ if ((fd = socket(domain, type, protocol)) >= 0)
+ goto finish;
+
+ /* return error */
+ return fd;
finish:
/* Some implementations might simply ignore SOCK_CLOEXEC if it is
@@ -3387,8 +3393,11 @@ int pa_pipe_cloexec(int pipefd[2]) {
#endif
- if ((r = pipe(pipefd)) < 0)
- return r;
+ if ((r = pipe(pipefd)) >= 0)
+ goto finish;
+
+ /* return error */
+ return r;
finish:
pa_make_fd_cloexec(pipefd[0]);
@@ -3409,8 +3418,11 @@ int pa_accept_cloexec(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
#endif
- if ((fd = accept(sockfd, addr, addrlen)) < 0)
- return fd;
+ if ((fd = accept(sockfd, addr, addrlen)) >= 0)
+ goto finish;
+
+ /* return error */
+ return fd;
finish:
pa_make_fd_cloexec(fd);