From: David Goulet Date: Tue, 11 Sep 2012 19:36:11 +0000 (-0400) Subject: Fix: consumer recv command error path X-Git-Tag: v2.0.5~4 X-Git-Url: http://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=3fa5d621da48eaeedaa1bc49fcf093d1c9b0d196 Fix: consumer recv command error path See bug #332. Backported from the master branch with commit id: 4cbc1a04e8ac3c1dd4f9a4dc44b56ee8430189f0 Signed-off-by: David Goulet --- diff --git a/src/common/consumer.c b/src/common/consumer.c index dd8c621f1..024ee1785 100644 --- a/src/common/consumer.c +++ b/src/common/consumer.c @@ -1221,8 +1221,12 @@ void *lttng_consumer_thread_receive_fds(void *data) DBG("Received STOP command"); goto end; } - if (ret < 0) { - ERR("Communication interrupted on command socket"); + if (ret <= 0) { + /* + * This could simply be a session daemon quitting. Don't output + * ERR() here. + */ + DBG("Communication interrupted on command socket"); goto end; } if (consumer_quit) { diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c index 3c9687306..0dfaa16e7 100644 --- a/src/common/kernel-consumer/kernel-consumer.c +++ b/src/common/kernel-consumer/kernel-consumer.c @@ -334,7 +334,12 @@ end: ret = write(ctx->consumer_poll_pipe[1], "", 1); } while (ret == -1UL && errno == EINTR); end_nosignal: - return 0; + + /* + * Return 1 to indicate success since the 0 value can be a socket shutdown + * during the recv() or send() call. + */ + return 1; } /* diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index 47c0d460f..935f6f311 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -282,7 +282,12 @@ end: ret = write(ctx->consumer_poll_pipe[1], "", 1); } while (ret == -1UL && errno == EINTR); end_nosignal: - return 0; + + /* + * Return 1 to indicate success since the 0 value can be a socket shutdown + * during the recv() or send() call. + */ + return 1; } int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan)