From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Pokorný Date: Tue, 9 Oct 2012 20:31:27 +0200 Subject: [Cluster-devel] [PATCH 1/2] libcman: E{INTR, AGAIN} in cman_dispatch repeated read needs -1 too In-Reply-To: <1349807488-29871-1-git-send-email-jpokorny@redhat.com> References: <1349807488-29871-1-git-send-email-jpokorny@redhat.com> Message-ID: <1349807488-29871-2-git-send-email-jpokorny@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Because otherwise, all you get during next cman_dispatch is noise (i.e., the incoming messages are misaligned wrt. their boundaries). In better case, this is captured as erroneous field value immediately, otherwise the result will be pretty crazy. The hypothetical "proper" fix is either: - making sure EINTR/EAGAIN does not break atomicity of message receiving (which in turn may break nonblocking character) - the part of yet-read message is stored in the handle (similar to reply_buf{fer,len} items) Signed-off-by: Jan Pokorn? --- cman/lib/libcman.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/cman/lib/libcman.c b/cman/lib/libcman.c index 6ed8ecb..26c09f2 100644 --- a/cman/lib/libcman.c +++ b/cman/lib/libcman.c @@ -539,13 +539,6 @@ int cman_dispatch(cman_handle_t handle, int flags) return -1; } - if (len < 0 && - (errno == EINTR || errno == EAGAIN)) { - if (bufptr != buf) - free(bufptr); - return 0; - } - if (len < 0) { if (bufptr != buf) free(bufptr); -- 1.7.11.4