From ce68ee76b946b775c6652ff9c737c575f3b931f9 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 7 Apr 2009 18:48:04 +0000 Subject: [PATCH] accommodate iov_len of type size_t (i.e., never negative) * services/pload.c (send_message): Don't test for iov_len < 0, since it can no longer happen. * lib/evs.c: Fix a typo in an iov_len-related FIXME comment. git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2018 fd59a12c-fef9-0310-b244-a6a79926bd2f --- lib/evs.c | 2 +- services/pload.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/evs.c b/lib/evs.c index 7dc39af0..638b8018 100644 --- a/lib/evs.c +++ b/lib/evs.c @@ -472,7 +472,7 @@ evs_error_t evs_mcast_groups ( int i; evs_error_t error; struct evs_inst *evs_inst; - struct iovec iov[64]; + struct iovec iov[64]; /* FIXME: what if iov_len > 62 ? use malloc */ struct req_lib_evs_mcast_groups req_lib_evs_mcast_groups; struct res_lib_evs_mcast_groups res_lib_evs_mcast_groups; int msg_len = 0; diff --git a/services/pload.c b/services/pload.c index 6a72a955..52713c0e 100644 --- a/services/pload.c +++ b/services/pload.c @@ -263,7 +263,7 @@ static int send_message (enum totem_callback_token_type type, void *arg) struct req_exec_pload_mcast req_exec_pload_mcast; struct iovec iov[2]; unsigned int res; - int iov_len = 2; + int iov_len = 1; req_exec_pload_mcast.header.id = SERVICE_ID_MAKE (PLOAD_SERVICE, MESSAGE_REQ_EXEC_PLOAD_MCAST); @@ -271,10 +271,10 @@ static int send_message (enum totem_callback_token_type type, void *arg) iov[0].iov_base = &req_exec_pload_mcast; iov[0].iov_len = sizeof (struct req_exec_pload_mcast); - iov[1].iov_base = buffer; - iov[1].iov_len = msg_size - sizeof (struct req_exec_pload_mcast); - if (iov[1].iov_len < 0) { - iov_len = 1; + if (msg_size > sizeof (req_exec_pload_mcast)) { + iov[1].iov_base = buffer; + iov[1].iov_len = msg_size - sizeof (req_exec_pload_mcast); + iov_len = 2; } do {