Fix: Don't assume that PROT_WRITE grants read permissions
[babeltrace.git] / formats / lttng-live / lttng-live-comm.c
index 0cd62f9812b8d03a201f2f85572697f8a2666c72..238cafdd002360a51ccb82c72fb3addebec5dabd 100644 (file)
@@ -1065,7 +1065,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);
@@ -1076,7 +1077,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.023162 seconds and 4 git commands to generate.