mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
raop: Fix loop searching for port number
do...while not reachable, loop should try different ports in case EADDRINUSE is returned Coverity ID: #1398161 Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
This commit is contained in:
parent
ad9c8603b0
commit
df9cda67d2
1 changed files with 7 additions and 4 deletions
|
|
@ -799,13 +799,16 @@ static int open_bind_udp_socket(pa_raop_client *c, uint16_t *actual_port) {
|
|||
}
|
||||
|
||||
do {
|
||||
*sa_port = htons(port);
|
||||
int ret;
|
||||
|
||||
if (bind(fd, sa, salen) < 0 && errno != EADDRINUSE) {
|
||||
pa_log("bind_socket() failed: %s", pa_cstrerror(errno));
|
||||
*sa_port = htons(port);
|
||||
ret = bind(fd, sa, salen);
|
||||
if (!ret)
|
||||
break;
|
||||
if (ret < 0 && errno != EADDRINUSE) {
|
||||
pa_log("bind() failed: %s", pa_cstrerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
break;
|
||||
} while (++port > 0);
|
||||
|
||||
pa_log_debug("Socket bound to port %d (SOCK_DGRAM)", port);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue