Fix: perf ust: check close return value
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 30 Apr 2014 16:09:59 +0000 (18:09 +0200)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 30 Apr 2014 16:09:59 +0000 (18:09 +0200)
Fix coverity defect:
** CID 1208905:  Unchecked return value  (CHECKED_RETURN)
/liblttng-ust/lttng-context-perf-counters.c: 147 in setup_perf()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust/lttng-context-perf-counters.c

index d6bd41cc9e20a170dc73f5d76d473781cdd1e737..99691c067f23a421ceee6f5f07f883b68b543e03 100644 (file)
@@ -134,7 +134,7 @@ static
 struct perf_event_mmap_page *setup_perf(struct perf_event_attr *attr)
 {
        void *perf_addr;
-       int fd;
+       int fd, ret;
 
        fd = sys_perf_event_open(attr, 0, -1, -1, 0);
        if (fd < 0)
@@ -144,7 +144,10 @@ struct perf_event_mmap_page *setup_perf(struct perf_event_attr *attr)
                        PROT_READ, MAP_SHARED, fd, 0);
        if (perf_addr == MAP_FAILED)
                return NULL;
-       close(fd);
+       ret = close(fd);
+       if (ret) {
+               perror("Error closing LTTng-UST perf memory mapping FD");
+       }
        return perf_addr;
 }
 
This page took 0.025556 seconds and 4 git commands to generate.