From: Vitaliy Mysak Date: Thu, 30 Jan 2020 08:05:39 +0000 (+0100) Subject: vhost: do not treat empty socket message as error X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=bedf87c521902d1caeb0974fe9d3344584b849b5;p=dpdk.git vhost: do not treat empty socket message as error According to recvmsg() specification, 0 is a valid return code when client is disconnecting. Therefore, it should not be reported as error, unless there are other dependencies that require message to not be empty. But there are none, since the next immediate caller of recvmsg() reports "vhost peer closed" info (not error) when message is empty. This patch changes return code check for recvmsg() so that misleading error message is not printed when the code is 0. Fixes: 8f972312b8f4 ("vhost: support vhost-user") Cc: stable@dpdk.org Signed-off-by: Vitaliy Mysak Reviewed-by: Tiwei Bie --- diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c index 85c64485c2..7c80121790 100644 --- a/lib/librte_vhost/socket.c +++ b/lib/librte_vhost/socket.c @@ -127,7 +127,8 @@ read_fd_message(int sockfd, char *buf, int buflen, int *fds, int max_fds, ret = recvmsg(sockfd, &msgh, 0); if (ret <= 0) { - VHOST_LOG_CONFIG(ERR, "recvmsg failed\n"); + if (ret) + VHOST_LOG_CONFIG(ERR, "recvmsg failed\n"); return ret; }