* Re: [PATCH lttng-tools 1/1] Fix: relayd: handling of lttng_read errors >= 0
[not found] <20190403202645.29404-1-mathieu.desnoyers@efficios.com>
@ 2019-04-25 18:27 ` Jérémie Galarneau
0 siblings, 0 replies; 2+ messages in thread
From: Jérémie Galarneau @ 2019-04-25 18:27 UTC (permalink / raw)
To: Mathieu Desnoyers; +Cc: lttng-dev, jgalar
Merged in master, stable-2.11, stable-2.10, and stable-2.9.
Thanks!
Jérémie
On Wed, Apr 03, 2019 at 04:26:45PM -0400, Mathieu Desnoyers wrote:
> 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>
> ---
> 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 12d54e00..9bfb56fa 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.17.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH lttng-tools 1/1] Fix: relayd: handling of lttng_read errors >= 0
@ 2019-04-03 20:26 Mathieu Desnoyers
0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Desnoyers @ 2019-04-03 20:26 UTC (permalink / raw)
To: jgalar; +Cc: lttng-dev
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>
---
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 12d54e00..9bfb56fa 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.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-04-25 18:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20190403202645.29404-1-mathieu.desnoyers@efficios.com>
2019-04-25 18:27 ` [PATCH lttng-tools 1/1] Fix: relayd: handling of lttng_read errors >= 0 Jérémie Galarneau
2019-04-03 20:26 Mathieu Desnoyers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).