]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib/tsocket: make use of samba_socket_sock_error()
authorStefan Metzmacher <metze@samba.org>
Thu, 12 Jan 2023 10:35:11 +0000 (11:35 +0100)
committerRalph Boehme <slow@samba.org>
Tue, 24 Oct 2023 09:36:37 +0000 (09:36 +0000)
This is nicer than calling getsockopt(state->fd, SOL_SOCKET, SO_ERROR)
directly.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/tsocket/tsocket_bsd.c

index 50ac0b280abecbf82acec06324dae57b1df851db..9f3f00f107f894859850a6cc40f4e578b70b4a55 100644 (file)
@@ -2613,18 +2613,10 @@ static void tstream_bsd_connect_fde_handler(struct tevent_context *ev,
                                        struct tstream_bsd_connect_state);
        struct samba_sockaddr *lrbsda = NULL;
        int ret;
-       int error=0;
-       socklen_t len = sizeof(error);
        int err;
        bool retry;
 
-       ret = getsockopt(state->fd, SOL_SOCKET, SO_ERROR, &error, &len);
-       if (ret == 0) {
-               if (error != 0) {
-                       errno = error;
-                       ret = -1;
-               }
-       }
+       ret = samba_socket_sock_error(state->fd);
        err = tsocket_bsd_error_from_errno(ret, errno, &retry);
        if (retry) {
                /* retry later */