Fix: relayd: handling of lttng_read errors >= 0
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 3 Apr 2019 20:26:45 +0000 (16:26 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 24 Apr 2019 22:58:44 +0000 (18:58 -0400)
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 <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/index/index.c

index fae1bfd4bcabdd9ba90ee3600733264e581ec7dc..40ac0de199cd53bdcba43bb80bbd91253e63276e 100644 (file)
@@ -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:
This page took 0.02571 seconds and 4 git commands to generate.