mirror of https://gerrit.osmocom.org/libosmocore
timerfd_create(): Fix error handling of osmo_fd_register()
Change-Id: Ia2528cc3e3155bbc9cb32dee0e3af99cc6e1c654 Closes: Coverity CID#188853
This commit is contained in:
parent
41b6b5e3fc
commit
37608f911d
|
@ -324,11 +324,18 @@ int osmo_timerfd_setup(struct osmo_fd *ofd, int (*cb)(struct osmo_fd *, unsigned
|
|||
ofd->when = BSC_FD_READ;
|
||||
|
||||
if (ofd->fd < 0) {
|
||||
int rc;
|
||||
|
||||
ofd->fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);
|
||||
if (ofd->fd < 0)
|
||||
return ofd->fd;
|
||||
|
||||
osmo_fd_register(ofd);
|
||||
rc = osmo_fd_register(ofd);
|
||||
if (rc < 0) {
|
||||
close(ofd->fd);
|
||||
ofd->fd = -1;
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue