[pulseaudio-discuss] [PATCH] socket-server: Improve readability
Tanu Kaskinen
tanu.kaskinen at linux.intel.com
Mon Nov 3 01:24:59 PST 2014
---
src/pulsecore/socket-server.c | 30 ++++++++++++++----------------
1 file changed, 14 insertions(+), 16 deletions(-)
diff --git a/src/pulsecore/socket-server.c b/src/pulsecore/socket-server.c
index ef77563..25a2f8a 100644
--- a/src/pulsecore/socket-server.c
+++ b/src/pulsecore/socket-server.c
@@ -260,15 +260,14 @@ pa_socket_server* pa_socket_server_new_ipv4(pa_mainloop_api *m, uint32_t address
if (errno == EADDRINUSE && fallback) {
sa.sin_port = 0;
- if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) >= 0)
- goto good;
+ if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
+ pa_log("bind(): %s", pa_cstrerror(errno));
+ goto fail;
+ }
+ } else {
+ pa_log("bind(): %s", pa_cstrerror(errno));
+ goto fail;
}
-
- pa_log("bind(): %s", pa_cstrerror(errno));
- goto fail;
-
- good:
- ;
}
if (listen(fd, 5) < 0) {
@@ -329,15 +328,14 @@ pa_socket_server* pa_socket_server_new_ipv6(pa_mainloop_api *m, const uint8_t ad
if (errno == EADDRINUSE && fallback) {
sa.sin6_port = 0;
- if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) >= 0)
- goto good;
+ if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
+ pa_log("bind(): %s", pa_cstrerror(errno));
+ goto fail;
+ }
+ } else {
+ pa_log("bind(): %s", pa_cstrerror(errno));
+ goto fail;
}
-
- pa_log("bind(): %s", pa_cstrerror(errno));
- goto fail;
-
- good:
- ;
}
if (listen(fd, 5) < 0) {
--
1.9.3
More information about the pulseaudio-discuss
mailing list