]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:rpc_server: simplify the error checking of create_tcpip_socket() callers
authorStefan Metzmacher <metze@samba.org>
Tue, 4 Jun 2019 12:12:56 +0000 (14:12 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 22 Jul 2019 16:49:13 +0000 (16:49 +0000)
create_tcpip_socket() never returns a valid fd and left port as 0.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/rpc_server/rpc_sock_helper.c

index 392005d8a78a917b3543e2bec06f9c34592dc07d..d575e2ea1dc7f6005ad38d4d2bb7ac8f01c31548 100644 (file)
@@ -61,11 +61,8 @@ NTSTATUS rpc_create_tcpip_sockets(const struct ndr_interface_table *iface,
                        int fd;
 
                        fd = create_tcpip_socket(ifss, &p);
-                       if (fd < 0 || p == 0) {
+                       if (fd < 0) {
                                status = NT_STATUS_UNSUCCESSFUL;
-                               if (fd != -1) {
-                                       close(fd);
-                               }
                                goto done;
                        }
                        listen_fd[*listen_fd_size] = fd;
@@ -125,11 +122,8 @@ NTSTATUS rpc_create_tcpip_sockets(const struct ndr_interface_table *iface,
                        }
 
                        fd = create_tcpip_socket(&ss, &p);
-                       if (fd < 0 || p == 0) {
+                       if (fd < 0) {
                                status = NT_STATUS_UNSUCCESSFUL;
-                               if (fd != -1) {
-                                       close(fd);
-                               }
                                goto done;
                        }
                        listen_fd[*listen_fd_size] = fd;