From daf6815021db8436946d02512716bc57fb3c5040 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 3 Apr 2019 16:26:45 -0400 Subject: [PATCH] Fix: relayd: handling of lttng_read errors >= 0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit errno is only set when lttng_read returns a negative value. Else, we need to print a ERR() statement rather than use PERROR(). Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- src/common/index/index.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/index/index.c b/src/common/index/index.c index 12d54e006..9bfb56fa0 100644 --- a/src/common/index/index.c +++ b/src/common/index/index.c @@ -171,10 +171,14 @@ int lttng_index_file_read(const struct lttng_index_file *index_file, } ret = lttng_read(fd, element, len); - if (ret < len) { + if (ret < 0) { PERROR("read index file"); goto error; } + if (ret < len) { + ERR("lttng_read expected %zu, returned %zd", len, ret); + goto error; + } return 0; error: -- 2.34.1