From 00c8752be51d75fcec3c30302db3d42cd714f02c Mon Sep 17 00:00:00 2001 From: David Goulet Date: Tue, 6 Nov 2012 09:41:35 -0500 Subject: [PATCH] Fix: Add EPIPE error handling on buffer splice Even though this is _not_ documented in splice(2), if the fd_out is a socket but closed on one end, splice returns a negative value and set errno to EPIPE. The man page specifies a EBADF but I guess both are possible (and it is according to the kernel 3.6.2 source). So, when streaming a kernel session (using splice), if the relayd quits, a splice on the socket returns an EPIPE. Signed-off-by: David Goulet --- src/common/consumer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/consumer.c b/src/common/consumer.c index ca6aeba3f..acbc6783b 100644 --- a/src/common/consumer.c +++ b/src/common/consumer.c @@ -1559,7 +1559,7 @@ ssize_t lttng_consumer_on_read_subbuffer_splice( written = ret_splice; } /* Socket operation failed. We consider the relayd dead */ - if (errno == EBADF) { + if (errno == EBADF || errno == EPIPE) { WARN("Remote relayd disconnected. Stopping"); relayd_hang_up = 1; goto write_error; -- 2.34.1