tsocket: use the correct 'ret' variable for tdgram_disconnect_send/recv()
authorStefan Metzmacher <metze@samba.org>
Fri, 3 Apr 2009 12:29:51 +0000 (14:29 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 6 Apr 2009 13:49:08 +0000 (15:49 +0200)
metze

lib/tsocket/tsocket_bsd.c

index 4ccaff46e3b460c89d6c5bef7179d7fca718bbfc..6d27ccae22082eef5ce2aa431e863876aa516ab9 100644 (file)
@@ -1658,7 +1658,7 @@ static ssize_t tdgram_bsd_sendto_recv(struct tevent_req *req, int *perrno)
 }
 
 struct tdgram_bsd_disconnect_state {
 }
 
 struct tdgram_bsd_disconnect_state {
-       int ret;
+       void *__dummy;
 };
 
 static struct tevent_req *tdgram_bsd_disconnect_send(TALLOC_CTX *mem_ctx,
 };
 
 static struct tevent_req *tdgram_bsd_disconnect_send(TALLOC_CTX *mem_ctx,
@@ -1677,7 +1677,6 @@ static struct tevent_req *tdgram_bsd_disconnect_send(TALLOC_CTX *mem_ctx,
        if (req == NULL) {
                return NULL;
        }
        if (req == NULL) {
                return NULL;
        }
-       state->ret = -1;
 
        if (bsds->read_req || bsds->write_req) {
                tevent_req_error(req, EBUSY);
 
        if (bsds->read_req || bsds->write_req) {
                tevent_req_error(req, EBUSY);
@@ -1689,7 +1688,7 @@ static struct tevent_req *tdgram_bsd_disconnect_send(TALLOC_CTX *mem_ctx,
                goto post;
        }
 
                goto post;
        }
 
-       state->ret = close(bsds->fd);
+       ret = close(bsds->fd);
        bsds->fd = -1;
        err = tsocket_error_from_errno(ret, errno, &dummy);
        if (tevent_req_error(req, err)) {
        bsds->fd = -1;
        err = tsocket_error_from_errno(ret, errno, &dummy);
        if (tevent_req_error(req, err)) {
@@ -1705,14 +1704,9 @@ post:
 static int tdgram_bsd_disconnect_recv(struct tevent_req *req,
                                      int *perrno)
 {
 static int tdgram_bsd_disconnect_recv(struct tevent_req *req,
                                      int *perrno)
 {
-       struct tdgram_bsd_disconnect_state *state = tevent_req_data(req,
-                                       struct tdgram_bsd_disconnect_state);
        int ret;
 
        ret = tsocket_simple_int_recv(req, perrno);
        int ret;
 
        ret = tsocket_simple_int_recv(req, perrno);
-       if (ret == 0) {
-               ret = state->ret;
-       }
 
        tevent_req_received(req);
        return ret;
 
        tevent_req_received(req);
        return ret;