]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: sock: rename sock to sock_fd in sock_create_server_socket
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Tue, 23 Apr 2024 20:46:55 +0000 (22:46 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 30 Apr 2024 19:38:12 +0000 (21:38 +0200)
Renaming sock to sock_fd makes it more clear, that sock_create_server_socket
returns the fd of newly created server socket and then we check this fd.
As we heavily use "fd" variable name in all protocol implementations, let's
prefix this one with the name of its object file: sock.o.

src/sock.c

index f1dfea404e07eba3a387239c5e1c8f1a7d71eda3..80cddcd63dfb0ce3a75b703c72614b0688de14fb 100644 (file)
@@ -204,7 +204,7 @@ struct connection *sock_accept_conn(struct listener *l, int *status)
 int sock_create_server_socket(struct connection *conn)
 {
        const struct netns_entry *ns = NULL;
-       int sock;
+       int sock_fd;
 
 #ifdef USE_NS
        if (objt_server(conn->target)) {
@@ -214,16 +214,16 @@ int sock_create_server_socket(struct connection *conn)
                        ns = __objt_server(conn->target)->netns;
        }
 #endif
-       sock = my_socketat(ns, conn->dst->ss_family, SOCK_STREAM, 0);
-       if (sock == -1)
+       sock_fd = my_socketat(ns, conn->dst->ss_family, SOCK_STREAM, 0);
+       if (sock_fd == -1)
                goto end;
        if (conn->flags & CO_FL_OPT_MARK)
-               sock_set_mark(sock, conn->mark);
+               sock_set_mark(sock_fd, conn->mark);
        if (conn->flags & CO_FL_OPT_TOS)
-               sock_set_tos(sock, conn->dst, conn->tos);
+               sock_set_tos(sock_fd, conn->dst, conn->tos);
 
  end:
-       return sock;
+       return sock_fd;
 }
 
 /* Enables receiving on receiver <rx> once already bound. */