mirror of https://gerrit.osmocom.org/libosmocore
Fix unchecked return valueof osmo_fd_register()
Change-Id: Ib040a7f94eb1bbec8270b66fd4c2aedef9d5346a Fixes: Coverity CID 57636
This commit is contained in:
parent
96831049d9
commit
9d862c8998
|
@ -333,7 +333,7 @@ static int gsmtap_sink_fd_cb(struct osmo_fd *fd, unsigned int flags)
|
|||
*/
|
||||
int gsmtap_source_add_sink(struct gsmtap_inst *gti)
|
||||
{
|
||||
int fd;
|
||||
int fd, rc;
|
||||
|
||||
fd = gsmtap_source_add_sink_fd(gsmtap_inst_fd(gti));
|
||||
if (fd < 0)
|
||||
|
@ -347,7 +347,11 @@ int gsmtap_source_add_sink(struct gsmtap_inst *gti)
|
|||
sink_ofd->when = BSC_FD_READ;
|
||||
sink_ofd->cb = gsmtap_sink_fd_cb;
|
||||
|
||||
osmo_fd_register(sink_ofd);
|
||||
rc = osmo_fd_register(sink_ofd);
|
||||
if (rc < 0) {
|
||||
close(fd);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
return fd;
|
||||
|
@ -368,7 +372,7 @@ struct gsmtap_inst *gsmtap_source_init(const char *host, uint16_t port,
|
|||
int ofd_wq_mode)
|
||||
{
|
||||
struct gsmtap_inst *gti;
|
||||
int fd;
|
||||
int fd, rc;
|
||||
|
||||
fd = gsmtap_source_init_fd(host, port);
|
||||
if (fd < 0)
|
||||
|
@ -383,7 +387,11 @@ struct gsmtap_inst *gsmtap_source_init(const char *host, uint16_t port,
|
|||
osmo_wqueue_init(>i->wq, 64);
|
||||
gti->wq.write_cb = &gsmtap_wq_w_cb;
|
||||
|
||||
osmo_fd_register(>i->wq.bfd);
|
||||
rc = osmo_fd_register(>i->wq.bfd);
|
||||
if (rc < 0) {
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return gti;
|
||||
|
|
Loading…
Reference in New Issue