mirror of
https://passt.top/passt
synced 2024-12-22 13:45:32 +00:00
tap: Exit if we fail to bind a UNIX domain socket with explicit path
In tap_sock_unix_open(), if we have a given path for the socket from configuration, we don't need to loop over possible paths, so we exit the loop on the first iteration, unconditionally. But if we failed to bind() the socket to that explicit path, we should exit, instead of continuing. Otherwise we'll pretend we're up and running, but nobody can contact us, and this might be mildly confusing for users. Link: https://bugzilla.redhat.com/show_bug.cgi?id=2299474 Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
f72d35a78d
commit
6ff702f325
7
tap.c
7
tap.c
@ -1139,8 +1139,11 @@ int tap_sock_unix_open(char *sock_path)
|
||||
close(ex);
|
||||
|
||||
unlink(path);
|
||||
if (!bind(fd, (const struct sockaddr *)&addr, sizeof(addr)) ||
|
||||
*sock_path)
|
||||
ret = bind(fd, (const struct sockaddr *)&addr, sizeof(addr));
|
||||
if (*sock_path && ret)
|
||||
die_perror("Failed to bind UNIX domain socket");
|
||||
|
||||
if (!ret)
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user