From: Mathieu Desnoyers Date: Wed, 3 Apr 2019 20:26:45 +0000 (-0400) Subject: Fix: relayd: handling of lttng_read errors >= 0 X-Git-Tag: v2.12.0-rc1~604 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2239b15a8b2a1f0bd81c9c1da3d74de3529ca493;p=lttng-tools.git Fix: relayd: handling of lttng_read errors >= 0 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 --- diff --git a/src/common/index/index.c b/src/common/index/index.c index fae1bfd4b..40ac0de19 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: