mirror of https://gerrit.osmocom.org/libosmocore
osmo_io: Log error message in case call-backs incompatible with mode
Change-Id: I50ba6a76c0144f249d67488874a6c4edf01ec6f2
This commit is contained in:
parent
ba6ea957a5
commit
bb1bba9dd5
|
@ -619,8 +619,11 @@ struct osmo_io_fd *osmo_iofd_setup(const void *ctx, int fd, const char *name, en
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioops && !check_mode_callback_compat(mode, ioops))
|
if (ioops && !check_mode_callback_compat(mode, ioops)) {
|
||||||
|
LOGP(DLIO, LOGL_ERROR, "iofd(%s): rejecting call-backs incompatible with mode\n",
|
||||||
|
name ? name : "unknown");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
iofd = talloc_zero(ctx, struct osmo_io_fd);
|
iofd = talloc_zero(ctx, struct osmo_io_fd);
|
||||||
if (!iofd)
|
if (!iofd)
|
||||||
|
@ -869,8 +872,10 @@ void osmo_iofd_set_name(struct osmo_io_fd *iofd, const char *name)
|
||||||
* \param[in] ioops osmo_io_ops structure to be set */
|
* \param[in] ioops osmo_io_ops structure to be set */
|
||||||
int osmo_iofd_set_ioops(struct osmo_io_fd *iofd, const struct osmo_io_ops *ioops)
|
int osmo_iofd_set_ioops(struct osmo_io_fd *iofd, const struct osmo_io_ops *ioops)
|
||||||
{
|
{
|
||||||
if (!check_mode_callback_compat(iofd->mode, ioops))
|
if (!check_mode_callback_compat(iofd->mode, ioops)) {
|
||||||
|
LOGPIO(iofd, LOGL_ERROR, "rejecting call-backs incompatible with mode\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
iofd->io_ops = *ioops;
|
iofd->io_ops = *ioops;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue