lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
From: "Jérémie Galarneau" <jeremie.galarneau@efficios.com>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: lttng-dev <lttng-dev@lists.lttng.org>,
	Jeremie Galarneau <jgalar@efficios.com>
Subject: Re: [PATCH babeltrace-1.5 6/6] Fix: lttng-live format: do not error out on empty streams hang up
Date: Thu, 12 Dec 2019 20:03:30 -0500	[thread overview]
Message-ID: <CA+jJMxvMQMPtEALXmZsm5v7rd9svZM1XCfXWqVRuYMQUprZePg__14472.1287231491$1576199072$gmane$org@mail.gmail.com> (raw)
In-Reply-To: <20191205065809.16728-7-mathieu.desnoyers@efficios.com>

All patches of this series were merged in stable-1.5.

Thanks!
Jérémie

On Thu, 5 Dec 2019 at 01:58, Mathieu Desnoyers
<mathieu.desnoyers@efficios.com> wrote:
>
> Attaching to a stream hung up before providing any trace packet
> causes ctf_open_mmap_stream_read() to return an error.
>
> This kind of scenario can happen with the upcoming "lttng clear"
> feature.
>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> ---
>  formats/ctf/ctf.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c
> index 980ebc9a..1ba9017f 100644
> --- a/formats/ctf/ctf.c
> +++ b/formats/ctf/ctf.c
> @@ -2571,8 +2571,13 @@ int ctf_open_mmap_stream_read(struct ctf_trace *td,
>         }
>
>         ret = prepare_mmap_stream_definition(td, file_stream, packet_seek);
> -       if (ret)
> +       if (ret) {
> +               /* We need to check for EOF here for empty files. */
> +               if (unlikely(file_stream->pos.offset == EOF)) {
> +                       ret = 0;
> +               }
>                 goto error_index;
> +       }
>
>         /*
>          * For now, only a single clock per trace is supported.
> --
> 2.17.1
>


-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

      parent reply	other threads:[~2019-12-13  1:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191205065809.16728-1-mathieu.desnoyers@efficios.com>
2019-12-05  6:58 ` [PATCH babeltrace-1.5 1/6] Fix: lttng-live: use-after-free in get_next_index() Mathieu Desnoyers
2019-12-05  6:58 ` [PATCH babeltrace-1.5 2/6] Fix: trace-collection: trace clock use after free Mathieu Desnoyers
2019-12-05  6:58 ` [PATCH babeltrace-1.5 3/6] Fix: lttng-live: lttng_live_open_trace_read memory leak Mathieu Desnoyers
2019-12-05  6:58 ` [PATCH babeltrace-1.5 4/6] Fix: lib/iterator.c: unbalanced ctx put (leak) Mathieu Desnoyers
2019-12-05  6:58 ` [PATCH babeltrace-1.5 5/6] Fix: lttng-live: ctf_live_packet_seek stream hang up handling Mathieu Desnoyers
2019-12-05  6:58 ` [PATCH babeltrace-1.5 6/6] Fix: lttng-live format: do not error out on empty streams hang up Mathieu Desnoyers
     [not found] ` <20191205065809.16728-7-mathieu.desnoyers@efficios.com>
2019-12-13  1:03   ` Jérémie Galarneau [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+jJMxvMQMPtEALXmZsm5v7rd9svZM1XCfXWqVRuYMQUprZePg__14472.1287231491$1576199072$gmane$org@mail.gmail.com' \
    --to=jeremie.galarneau@efficios.com \
    --cc=jgalar@efficios.com \
    --cc=lttng-dev@lists.lttng.org \
    --cc=mathieu.desnoyers@efficios.com \
    --subject='Re: [PATCH babeltrace-1.5 6/6] Fix: lttng-live format: do not error out on empty streams hang up' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).