From: Tiwei Bie Date: Tue, 6 Mar 2018 10:43:25 +0000 (+0800) Subject: vhost: do not generate signal when sendmsg fails X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7a36967029c0dc062bdc25fc28fb2c1d0bbca179;p=dpdk.git vhost: do not generate signal when sendmsg fails More precisely, do not generate a SIGPIPE signal if the peer has closed the connection. Otherwise, it will terminate the process by default. As a library, we should avoid terminating the application process when error happens and just need to return with an error. Signed-off-by: Tiwei Bie Reviewed-by: Maxime Coquelin --- diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c index cfc31e1797..992c7aa1ca 100644 --- a/lib/librte_vhost/socket.c +++ b/lib/librte_vhost/socket.c @@ -174,7 +174,7 @@ send_fd_message(int sockfd, char *buf, int buflen, int *fds, int fd_num) } do { - ret = sendmsg(sockfd, &msgh, 0); + ret = sendmsg(sockfd, &msgh, MSG_NOSIGNAL); } while (ret < 0 && errno == EINTR); if (ret < 0) {