Fix: make sure we can exit the get_new_metadata loop
[babeltrace.git] / formats / lttng-live / lttng-live-comm.c
index a3a02a2cc19ad1bc9741b8340d83fb92978136f6..e473181578142a560d206ce09bc915266e9f8351 100644 (file)
@@ -910,6 +910,10 @@ int get_new_metadata(struct lttng_live_ctx *ctx,
        }
 
        do {
+               if (lttng_live_should_quit()) {
+                       ret = -1;
+                       goto error;
+               }
                /*
                 * get_one_metadata_packet returns the number of bytes
                 * received, 0 when we have received everything, a
@@ -1066,7 +1070,8 @@ void read_packet_header(struct ctf_stream_pos *pos,
        int ret;
 
        /* update trace_packet_header and stream_packet_context */
-       if (pos->prot != PROT_WRITE && file_stream->parent.trace_packet_header) {
+       if (!(pos->prot & PROT_WRITE) &&
+               file_stream->parent.trace_packet_header) {
                /* Read packet header */
                ret = generic_rw(&pos->parent,
                                &file_stream->parent.trace_packet_header->p);
@@ -1077,7 +1082,8 @@ void read_packet_header(struct ctf_stream_pos *pos,
                        goto end;
                }
        }
-       if (pos->prot != PROT_WRITE && file_stream->parent.stream_packet_context) {
+       if (!(pos->prot & PROT_WRITE) &&
+               file_stream->parent.stream_packet_context) {
                /* Read packet context */
                ret = generic_rw(&pos->parent,
                                &file_stream->parent.stream_packet_context->p);
This page took 0.02439 seconds and 4 git commands to generate.