X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fust-consumer%2Fust-consumer.c;h=113682384ae44d829d03af00b1378d25687a4a39;hp=e81f05041249a164ce09151e9907c0602b41d6be;hb=87dc6a9c2c936cf4386043083412c695a914cb36;hpb=88f2b785b937a5c2af4e21e925b6242ea6c8362b diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index e81f05041..113682384 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -58,7 +58,7 @@ int lttng_ustconsumer_on_read_subbuffer_mmap( ret = ustctl_get_mmap_read_offset(stream->chan->handle, stream->buf, &mmap_offset); if (ret != 0) { - ret = -errno; + errno = -ret; perror("ustctl_get_mmap_read_offset"); goto end; } @@ -67,7 +67,7 @@ int lttng_ustconsumer_on_read_subbuffer_mmap( if (ret >= len) { len = 0; } else if (ret < 0) { - ret = -errno; + errno = -ret; perror("Error in file write"); goto end; } @@ -109,7 +109,7 @@ int lttng_ustconsumer_take_snapshot(struct lttng_consumer_local_data *ctx, ret = ustctl_snapshot(stream->chan->handle, stream->buf); if (ret != 0) { - ret = errno; + errno = -ret; perror("Getting sub-buffer snapshot."); } @@ -131,7 +131,7 @@ int lttng_ustconsumer_get_produced_snapshot( ret = ustctl_snapshot_get_produced(stream->chan->handle, stream->buf, pos); if (ret != 0) { - ret = errno; + errno = -ret; perror("kernctl_snapshot_get_produced"); } @@ -347,7 +347,7 @@ int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, if (!stream->hangup_flush_done) { do { readlen = read(stream->wait_fd, &dummy, 1); - } while (readlen == -1 && errno == -EINTR); + } while (readlen == -1 && errno == EINTR); if (readlen == -1) { ret = readlen; goto end;