Fix: out_fd can be uninitialized.
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 10 Apr 2019 20:11:30 +0000 (16:11 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 10 Apr 2019 23:36:37 +0000 (19:36 -0400)
If out_fd is uninitialized return success.

This happens for snapshot stream for example.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
src/common/consumer/consumer.c

index d46fc30a9f0817c48032e9ad69e5e07ec2f01843..5a87e18960921bae1bddac92bfe2393944f15244 100644 (file)
@@ -3886,6 +3886,11 @@ int consumer_clear_stream_files(struct lttng_consumer_stream *stream)
                return LTTCOMM_CONSUMERD_SUCCESS;
        }
 
+       /* Stream might not have out_fd set. Snapshot stream for example. */
+       if (stream->out_fd < 0) {
+               return LTTCOMM_CONSUMERD_SUCCESS;
+       }
+
        ret = close(stream->out_fd);
        if (ret < 0) {
                PERROR("Closing tracefile");
This page took 0.027501 seconds and 5 git commands to generate.