diff options
author | amine ahd <amine.ahd@gmail.com> | 2016-12-19 10:30:36 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2016-12-24 14:31:04 +0100 |
commit | df088f03c02aebba304a371486f09e95ed34bf5f (patch) | |
tree | 63e86f91a703ace2ff688c6c1c1015e69a408a8c /ubusd_proto.c | |
parent | 5ca6bae3a27ca02e304339ed0d94a8baa461b609 (diff) | |
download | ubus-df088f03c02aebba304a371486f09e95ed34bf5f.tar.gz |
Allow sending a fd along a ubus_request
Signed-off-by: amine.ahd <amine.ahd@gmail.com>
Diffstat (limited to 'ubusd_proto.c')
-rw-r--r-- | ubusd_proto.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ubusd_proto.c b/ubusd_proto.c index d2feed9..72da7a7 100644 --- a/ubusd_proto.c +++ b/ubusd_proto.c @@ -80,11 +80,15 @@ void ubus_proto_send_msg_from_blob(struct ubus_client *cl, struct ubus_msg_buf *ub, uint8_t type) { + /* keep the fd to be passed if it is UBUS_MSG_INVOKE */ + int fd = ub->fd; ub = ubus_reply_from_blob(ub, true); if (!ub) return; ub->hdr.type = type; + ub->fd = fd; + ubus_msg_send(cl, ub, true); } @@ -447,7 +451,7 @@ void ubusd_proto_receive_message(struct ubus_client *cl, struct ubus_msg_buf *ub if (ub->hdr.type < __UBUS_MSG_LAST) cb = handlers[ub->hdr.type]; - if (ub->hdr.type != UBUS_MSG_STATUS) + if (ub->hdr.type != UBUS_MSG_STATUS && ub->hdr.type != UBUS_MSG_INVOKE) ubus_msg_close_fd(ub); if (cb) |