From f1bb762f0245fcbfa6555fd90e71de61480c301c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sun, 9 Dec 2018 16:11:59 +0100 Subject: [PATCH] block: make blockd_notify() return an int instead of void MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It allows improving block by handling blockd_notify() errors. Signed-off-by: Rafał Miłecki --- block.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/block.c b/block.c index cfd95b4..3d06185 100644 --- a/block.c +++ b/block.c @@ -960,13 +960,14 @@ static int handle_mount(const char *source, const char *target, return err; } -static void blockd_notify(char *device, struct mount *m, struct probe_info *pr) +static int blockd_notify(char *device, struct mount *m, struct probe_info *pr) { struct ubus_context *ctx = ubus_connect(NULL); uint32_t id; + int err; if (!ctx) - return; + return -ENXIO; if (!ubus_lookup_id(ctx, "block", &id)) { struct blob_buf buf = { 0 }; @@ -1012,10 +1013,14 @@ static void blockd_notify(char *device, struct mount *m, struct probe_info *pr) blobmsg_add_u32(&buf, "remove", 1); } - ubus_invoke(ctx, id, "hotplug", buf.head, NULL, NULL, 3000); + err = ubus_invoke(ctx, id, "hotplug", buf.head, NULL, NULL, 3000); + } else { + err = -ENOENT; } ubus_free(ctx); + + return err; } static int mount_device(struct probe_info *pr, int type) -- 2.25.1