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>
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)
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;
}