From df088f03c02aebba304a371486f09e95ed34bf5f Mon Sep 17 00:00:00 2001 From: amine ahd Date: Mon, 19 Dec 2016 10:30:36 +0100 Subject: Allow sending a fd along a ubus_request Signed-off-by: amine.ahd --- ubusd_proto.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ubusd_proto.c') 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) -- cgit v1.2.1