From 883861544a879eb161b1186ba6c62335a923aaca Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 27 Jul 2006 09:18:28 +0000 Subject: [PATCH] * fhandler_socket.cc (fhandler_socket::recvmsg): Remove unused tot argument. All callers changed. (fhandler_socket::sendmsg): Likewise. * net.cc (cygwin_recvmsg): Likewise. (cygwin_sendmsg): Likewise, and prevent calling sendmsg whith an invalid iovec. * fhandler.h (fhandler_socket::recvmsg): Adjust prototype. (fhandler_socket::sendmsg): Likewise. --- winsup/cygwin/ChangeLog | 11 +++++++++++ winsup/cygwin/fhandler.h | 4 ++-- winsup/cygwin/fhandler_socket.cc | 8 ++++---- winsup/cygwin/net.cc | 5 +++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index d3693c526..c18b33f09 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,14 @@ +2006-07-27 Brian Ford + + * fhandler_socket.cc (fhandler_socket::recvmsg): Remove unused tot + argument. All callers changed. + (fhandler_socket::sendmsg): Likewise. + * net.cc (cygwin_recvmsg): Likewise. + (cygwin_sendmsg): Likewise, and prevent calling sendmsg whith an + invalid iovec. + * fhandler.h (fhandler_socket::recvmsg): Adjust prototype. + (fhandler_socket::sendmsg): Likewise. + 2006-07-27 Corinna Vinschen * fhandler.h (class fhandler_socket): Remove prot_info_ptr. diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 7b9ba7e3b..f03730eb8 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -462,14 +462,14 @@ class fhandler_socket: public fhandler_base struct sockaddr *from, int *fromlen); ssize_t recvfrom (void *ptr, size_t len, int flags, struct sockaddr *from, int *fromlen); - ssize_t recvmsg (struct msghdr *msg, int flags, ssize_t tot = -1); + ssize_t recvmsg (struct msghdr *msg, int flags); ssize_t writev (const struct iovec *, int iovcnt, ssize_t tot = -1); inline ssize_t send_internal (struct _WSABUF *wsabuf, DWORD wsacnt, int flags, const struct sockaddr *to, int tolen); ssize_t sendto (const void *ptr, size_t len, int flags, const struct sockaddr *to, int tolen); - ssize_t sendmsg (const struct msghdr *msg, int flags, ssize_t tot = -1); + ssize_t sendmsg (const struct msghdr *msg, int flags); int ioctl (unsigned int cmd, void *); int fcntl (int cmd, void *); diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index a6f760a9b..760dbc456 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -1153,7 +1153,7 @@ fhandler_socket::readv (const struct iovec *const iov, const int iovcnt, msg_flags: 0 }; - return recvmsg (&msg, 0, tot); + return recvmsg (&msg, 0); } inline ssize_t @@ -1217,7 +1217,7 @@ fhandler_socket::recvfrom (void *ptr, size_t len, int flags, } int -fhandler_socket::recvmsg (struct msghdr *msg, int flags, ssize_t tot) +fhandler_socket::recvmsg (struct msghdr *msg, int flags) { if (CYGWIN_VERSION_CHECK_FOR_USING_ANCIENT_MSGHDR) ((struct OLD_msghdr *) msg)->msg_accrightslen = 0; @@ -1266,7 +1266,7 @@ fhandler_socket::writev (const struct iovec *const iov, const int iovcnt, msg_flags: 0 }; - return sendmsg (&msg, 0, tot); + return sendmsg (&msg, 0); } inline ssize_t @@ -1324,7 +1324,7 @@ fhandler_socket::sendto (const void *ptr, size_t len, int flags, } int -fhandler_socket::sendmsg (const struct msghdr *msg, int flags, ssize_t tot) +fhandler_socket::sendmsg (const struct msghdr *msg, int flags) { if (get_addr_family () == AF_LOCAL) { diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 87a413556..5b8b78380 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -2071,7 +2071,7 @@ cygwin_recvmsg (int fd, struct msghdr *msg, int flags) { res = check_iovec_for_read (msg->msg_iov, msg->msg_iovlen); if (res > 0) - res = fh->recvmsg (msg, flags, res); // res == iovec tot + res = fh->recvmsg (msg, flags); } syscall_printf ("%d = recvmsg (%d, %p, %x)", res, fd, msg, flags); @@ -2093,7 +2093,8 @@ cygwin_sendmsg (int fd, const struct msghdr *msg, int flags) else { res = check_iovec_for_write (msg->msg_iov, msg->msg_iovlen); - res = fh->sendmsg (msg, flags, res); // res == iovec tot + if (res >= 0) + res = fh->sendmsg (msg, flags); } syscall_printf ("%d = sendmsg (%d, %p, %x)", res, fd, msg, flags); -- 2.43.5