libubus: close file descriptor after passing it in the status msg
Simplifies handling of non-deferred requests Signed-off-by: Felix Fietkau <nbd@openwrt.org>
This commit is contained in:
parent
334c389180
commit
8f3c5a7b50
2 changed files with 3 additions and 1 deletions
|
@ -68,7 +68,6 @@ static void test_hello_reply(struct uloop_timeout *t)
|
|||
pipe(fds);
|
||||
ubus_request_set_fd(ctx, &req->req, fds[0]);
|
||||
ubus_complete_deferred_request(ctx, &req->req, 0);
|
||||
close(fds[0]);
|
||||
req->fd = fds[1];
|
||||
|
||||
req->timeout.cb = test_hello_fd_reply;
|
||||
|
|
|
@ -142,6 +142,9 @@ int __hidden ubus_send_msg(struct ubus_context *ctx, uint32_t seq,
|
|||
if (ret < 0)
|
||||
ctx->sock.eof = true;
|
||||
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue