From: Willy Tarreau Date: Fri, 28 Aug 2020 16:45:01 +0000 (+0200) Subject: BUG/MINOR: reload: do not fail when no socket is sent X-Git-Tag: v2.1.9~41 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=dc938ccb53a9ac5a0c6ba694973204412c086003;p=haproxy-2.1.git BUG/MINOR: reload: do not fail when no socket is sent get_old_sockets() mistakenly sets ret=0 instead of ret2=0 before leaving when the old process announces zero FD. So it will return an error instead of success. This must be particularly rare not to have a single socket to offer though! A few comments were added to make it more obvious what to expect in return. This must be backported to 1.8 since the bug has always been there. (cherry picked from commit febbce87baf15b610d30172e37b98133e92159cc) Signed-off-by: Christopher Faulet (cherry picked from commit 899f15532e9770ccc3fa51b6ae237ffed8e1b5dc) Signed-off-by: Christopher Faulet --- diff --git a/src/haproxy.c b/src/haproxy.c index ff337a8..9924a36 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -1139,6 +1139,10 @@ next_dir_entry: free(err); } +/* Retrieves old sockets from worker process running the CLI at address + * . Fills xfer_sock_list with what is found. Returns 0 on + * success, -1 on failure. + */ static int get_old_sockets(const char *unixsocket) { char *cmsgbuf = NULL, *tmpbuf = NULL; @@ -1190,7 +1194,7 @@ static int get_old_sockets(const char *unixsocket) goto out; } if (fd_nb == 0) { - ret = 0; + ret2 = 0; goto out; } tmpbuf = malloc(fd_nb * (1 + MAXPATHLEN + 1 + IFNAMSIZ + sizeof(int)));