Fix: Don't assume that PROT_WRITE grants read permissions
[babeltrace.git] / formats / lttng-live / lttng-live-comm.c
index a3a02a2cc19ad1bc9741b8340d83fb92978136f6..5843fd7c80eaaa5022427f55a6d4bed4f4e98487 100644 (file)
@@ -1066,7 +1066,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 +1078,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.024273 seconds and 4 git commands to generate.