Revert "tsocket_bsd use sendmsg/recvmsg"
authorStefan Metzmacher <metze@samba.org>
Thu, 17 May 2018 08:32:16 +0000 (10:32 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 17 May 2018 08:32:16 +0000 (10:32 +0200)
This reverts commit dc245ae8fc23525d85575de2236c4f97daf9a6f3.

lib/tsocket/tsocket_bsd.c

index 9a6a9e2107438da190659527408936f4e769fe71..7ebc564692d79b0edfb6fac6733a5a266819e8e1 100644 (file)
@@ -929,10 +929,6 @@ static void tdgram_bsd_recvfrom_handler(void *private_data)
        ssize_t ret;
        int err;
        bool retry;
-#ifdef MSG_NOSIGNAL
-       struct msghdr msg;
-       struct iovec vec;
-#endif
 
        if (bsds->netlink) {
                ret = tsocket_bsd_netlink_pending(bsds->fd);
@@ -978,27 +974,8 @@ static void tdgram_bsd_recvfrom_handler(void *private_data)
        bsda->u.sa.sa_len = bsda->sa_socklen;
 #endif
 
-#ifdef MSG_NOSIGNAL
-       vec.iov_base = (char *)state->buf;
-       vec.iov_len = state->len;
-
-       msg.msg_name = &bsda->u.sa;    /* optional address */
-       msg.msg_namelen = bsda->sa_socklen; /* size of address */
-       msg.msg_iov = &vec;            /* scatter/gather array */
-       msg.msg_iovlen = 1;            /* # elements in msg_iov */
-       msg.msg_control = NULL;        /* ancillary data, see below */
-       msg.msg_controllen = 0;        /* ancillary data buffer len */
-       msg.msg_flags = 0;             /* flags on received message */
-
-       ret = recvmsg(bsds->fd, &msg, MSG_NOSIGNAL);
-       bsda->sa_socklen = msg.msg_namelen;
-#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
-       bsda->u.sa.sa_len = bsda->sa_socklen;
-#endif
-#else
        ret = recvfrom(bsds->fd, state->buf, state->len, 0,
                       &bsda->u.sa, &bsda->sa_socklen);
-#endif
        err = tsocket_bsd_error_from_errno(ret, errno, &retry);
        if (retry) {
                /* retry later */
@@ -1869,21 +1846,8 @@ static void tstream_bsd_readv_handler(void *private_data)
        int err;
        int _count;
        bool ok, retry;
-#ifdef MSG_NOSIGNAL
-       struct msghdr msg;
 
-       msg.msg_name = NULL;           /* optional address */
-       msg.msg_namelen = 0;           /* size of address */
-       msg.msg_iov = state->vector;   /* scatter/gather array */
-       msg.msg_iovlen = state->count; /* # elements in msg_iov */
-       msg.msg_control = NULL;        /* ancillary data, see below */
-       msg.msg_controllen = 0;        /* ancillary data buffer len */
-       msg.msg_flags = 0;             /* flags on received message */
-
-       ret = recvmsg(bsds->fd, &msg, MSG_NOSIGNAL);
-#else
        ret = readv(bsds->fd, state->vector, state->count);
-#endif
        if (ret == 0) {
                /* propagate end of file */
                tevent_req_error(req, EPIPE);