summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-10-19 12:19:56 +0200
committerlaforge <laforge@osmocom.org>2020-10-21 11:56:43 +0000
commitd90ae30caafb82dc96148bbdf43519c5a23b537f (patch)
tree3fd88aa42828a02f8efdc39fb587b17832666986 /src/host/layer23/src
parent2c0d9cdcc2ac999c200810199c7fc3161bb5fd36 (diff)
mobile: Use osmo_fd_setup() in script_lua.c
Diffstat (limited to 'src/host/layer23/src')
-rw-r--r--src/host/layer23/src/mobile/script_lua.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/host/layer23/src/mobile/script_lua.c b/src/host/layer23/src/mobile/script_lua.c
index 269c9dff..50315bdb 100644
--- a/src/host/layer23/src/mobile/script_lua.c
+++ b/src/host/layer23/src/mobile/script_lua.c
@@ -497,6 +497,7 @@ static int lua_fd_cb(struct osmo_fd *fd, unsigned int what) {
static int lua_register_fd(lua_State *L)
{
struct fd_userdata *fdu;
+ int fd;
/* fd, cb */
luaL_argcheck(L, lua_isnumber(L, -2), 1, "needs to be a filedescriptor");
@@ -510,10 +511,8 @@ static int lua_register_fd(lua_State *L)
lua_setmetatable(L, -2);
/* Set the filedescriptor */
- fdu->fd.fd = (int) lua_tonumber(L, -3);
- fdu->fd.cb = lua_fd_cb;
- fdu->fd.when = OSMO_FD_READ;
- fdu->fd.data = fdu;
+ fd = (int) lua_tonumber(L, -3);
+ osmo_fd_setup(&fdu->fd, fd, OSMO_FD_READ, lua_fd_cb, fdu, 0);
/* Assuming that an error here will lead to a GC */
if (osmo_fd_register(&fdu->fd) != 0) {