rs232-write: Check return value of osmo_fd_register()

Change-Id: If40e85600ca1dfbda5975d7aa92cccdb11f9c34d
Fixes: Coverity CID 57632
This commit is contained in:
Harald Welte 2016-11-26 15:38:37 +01:00
parent b2b2fe643f
commit 046b12fa88
1 changed files with 6 additions and 1 deletions

View File

@ -347,6 +347,7 @@ static int kbd_cb(struct osmo_fd *fd, unsigned int what)
int main(void)
{
struct osmo_fd *kbd_ofd;
int rc;
tall_test = talloc_named_const(NULL, 1, "osmo_rs232_test");
@ -379,7 +380,11 @@ int main(void)
kbd_ofd->when = BSC_FD_READ;
kbd_ofd->data = NULL;
kbd_ofd->cb = kbd_cb;
osmo_fd_register(kbd_ofd);
rc = osmo_fd_register(kbd_ofd);
if (rc < 0) {
LOGP(DRS232TEST, LOGL_ERROR, "FD Register\n");
exit(EXIT_FAILURE);
}
while(1) {
osmo_select_main(0);