On Wed, Jul 24, 2024 at 11:50:15PM +0200, Stefano Brivio wrote: > 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 Reviewed-by: David Gibson > --- > tap.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/tap.c b/tap.c > index 6930ad8..44bd444 100644 > --- a/tap.c > +++ b/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; > } > -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson