Fix an uninitialized variable read in async_connect_send
authorVolker Lendecke <vl@samba.org>
Fri, 5 Jun 2009 22:46:38 +0000 (00:46 +0200)
committerVolker Lendecke <vl@samba.org>
Sat, 6 Jun 2009 08:42:55 +0000 (10:42 +0200)
lib/async_req/async_sock.c

index a505fcf465679b3326d5567c55a22c9de5af0df4..643eb2d308f5c42686f310089d5dc1c4ad599b22 100644 (file)
@@ -223,6 +223,11 @@ struct tevent_req *async_connect_send(TALLOC_CTX *mem_ctx,
        state->fd = fd;
        state->sys_errno = 0;
 
+       state->old_sockflags = fcntl(fd, F_GETFL, 0);
+       if (state->old_sockflags == -1) {
+               goto post_errno;
+       }
+
        state->address_len = address_len;
        if (address_len > sizeof(state->address)) {
                errno = EINVAL;
@@ -230,11 +235,6 @@ struct tevent_req *async_connect_send(TALLOC_CTX *mem_ctx,
        }
        memcpy(&state->address, address, address_len);
 
-       state->old_sockflags = fcntl(fd, F_GETFL, 0);
-       if (state->old_sockflags == -1) {
-               goto post_errno;
-       }
-
        set_blocking(fd, false);
 
        state->result = connect(fd, address, address_len);