From: Quentin Young Date: Mon, 11 Feb 2019 21:22:05 +0000 (+0000) Subject: vrrpd: set sockets to -1 after closing X-Git-Tag: base_7.2~330^2~92 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=1b5e2a229dada21c07829e41275114f3c927f360;p=matthieu%2Ffrr.git vrrpd: set sockets to -1 after closing This also fixes a bug where assigning the same address as a VIP twice would succeed the second time even if it actually failed both times. Signed-off-by: Quentin Young --- diff --git a/vrrpd/vrrp.c b/vrrpd/vrrp.c index b01bcb939c..14347c239f 100644 --- a/vrrpd/vrrp.c +++ b/vrrpd/vrrp.c @@ -1001,10 +1001,14 @@ done: zlog_warn(VRRP_LOGPFX VRRP_LOGPFX_VRID "Failed to initialize VRRP %s router", r->vr->vrid, family2str(r->family)); - if (r->sock_rx >= 0) + if (r->sock_rx >= 0) { close(r->sock_rx); - if (r->sock_tx >= 0) + r->sock_rx = -1; + } + if (r->sock_tx >= 0) { close(r->sock_tx); + r->sock_tx = -1; + } ret = -1; }