]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: sock: do not double-close the accepted socket on the error path
authorWilly Tarreau <w@1wt.eu>
Tue, 12 Apr 2022 05:49:11 +0000 (07:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 12 Apr 2022 05:49:11 +0000 (07:49 +0200)
Coverity found in issue #1646 that I added a double-close bug in last
commit e4d09cedb ("MINOR: sock: check configured limits at the sock layer,
not the listener's") because the error path already closes the FD. No
backport needed.

src/sock.c

index 5afa59f33c6be0dcde5fe709c5ee5ef2b2c70b81..7ccdbd3baaae7b25d4709d9f76b3562ee7181cef 100644 (file)
@@ -104,7 +104,6 @@ struct connection *sock_accept_conn(struct listener *l, int *status)
 
        if (likely(cfd != -1)) {
                if (unlikely(cfd >= global.maxsock)) {
-                       close(cfd);
                        send_log(p, LOG_EMERG,
                                 "Proxy %s reached the configured maximum connection limit. Please check the global 'maxconn' value.\n",
                                 p->id);