]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: sockpair: move send_fd_uxst() error message in caller
authorWilliam Lallemand <wlallemand@haproxy.org>
Mon, 25 Jul 2022 14:04:38 +0000 (16:04 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Mon, 25 Jul 2022 14:11:11 +0000 (16:11 +0200)
Move the ha_alert() in send_fd_uxst() in the callers and add the FD
numbers in the message.

src/proto_sockpair.c
src/sock.c

index 60880b290514576d3947cb9167367c102fed8bd2..1c5d7422f715aefd5dabaddb0b0e2a781c21ae3f 100644 (file)
@@ -245,7 +245,6 @@ int send_fd_uxst(int fd, int send_fd)
        memcpy(fdptr, &send_fd, sizeof(send_fd));
 
        if (sendmsg(fd, &msghdr, 0) != sizeof(iobuf)) {
-               ha_warning("Failed to transfer socket\n");
                return -1;
        }
 
@@ -341,6 +340,7 @@ static int sockpair_connect_server(struct connection *conn, int flags)
        /* The new socket is sent on the other side, it should be retrieved and
         * considered as an 'accept' socket on the server side */
        if (send_fd_uxst(dst_fd, sv[0]) == -1) {
+               ha_alert("socketpair: Cannot transfer the fd %d over sockpair@%d. Giving up.\n", sv[0], dst_fd);
                close(sv[0]);
                close(sv[1]);
                conn->err_code = CO_ER_SOCK_ERR;
index a74e8194b2d11c2b6f85fa9e9499fc17d4edba81..1482c1a4f6a64afa015aff97c7f2f868bdf90194 100644 (file)
@@ -322,7 +322,7 @@ int sock_get_old_sockets(const char *unixsocket)
                }
 
                if (send_fd_uxst(dst_fd, sv[0]) == -1) {
-                       ha_alert("socketpair: cannot transfer socket.\n");
+                       ha_alert("socketpair: Cannot transfer the fd %d over sockpair@%d. Giving up.\n", sv[0], dst_fd);
                        close(sv[0]);
                        close(sv[1]);
                        goto out;