X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fust-consumer%2Fust-consumer.c;h=1a7b2cd4b5a01edd85cf83569d69109d454b6698;hb=1eb682be3330c00ac2ee60a596dda4eb440e3784;hp=df0911c7130c4995fc617acc0994a4366efcf03e;hpb=51a9e1c7f7fd48e2b53e258aee269a69cb8b59d3;p=lttng-tools.git diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index df0911c71..1a7b2cd4b 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -1881,14 +1881,16 @@ int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, /* Ease our life for what's next. */ ustream = stream->ustream; - /* We can consume the 1 byte written into the wait_fd by UST */ + /* + * We can consume the 1 byte written into the wait_fd by UST. + * Don't trigger error if we cannot read this one byte (read + * returns 0), or if the error is EAGAIN or EWOULDBLOCK. + */ if (stream->monitor && !stream->hangup_flush_done) { ssize_t readlen; - do { - readlen = read(stream->wait_fd, &dummy, 1); - } while (readlen == -1 && errno == EINTR); - if (readlen == -1 && errno != EAGAIN && errno != EWOULDBLOCK) { + readlen = lttng_read(stream->wait_fd, &dummy, 1); + if (readlen < 0 && errno != EAGAIN && errno != EWOULDBLOCK) { ret = readlen; goto end; } @@ -2262,14 +2264,14 @@ int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx, health_code_update(); - ret_code = lttng_ustconsumer_recv_metadata(ctx->consumer_metadata_socket, + ret = lttng_ustconsumer_recv_metadata(ctx->consumer_metadata_socket, key, offset, len, channel, timer, wait); - if (ret_code >= 0) { + if (ret >= 0) { /* * Only send the status msg if the sessiond is alive meaning a positive * ret code. */ - (void) consumer_send_status_msg(ctx->consumer_metadata_socket, ret_code); + (void) consumer_send_status_msg(ctx->consumer_metadata_socket, ret); } ret = 0;