Fix: Add EPIPE error handling on buffer splice
authorDavid Goulet <dgoulet@efficios.com>
Tue, 6 Nov 2012 14:41:35 +0000 (09:41 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 6 Nov 2012 14:41:35 +0000 (09:41 -0500)
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 <dgoulet@efficios.com>
src/common/consumer.c

index ca6aeba3ffd7a8748256bd9cae356eeff3e977b6..acbc6783b8f20cc4796526d1719d92e7a918cbc1 100644 (file)
@@ -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;
This page took 0.029113 seconds and 4 git commands to generate.