From: Rafał Miłecki Date: Sun, 9 Dec 2018 15:11:59 +0000 (+0100) Subject: block: make blockd_notify() return an int instead of void X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f1bb762f0245fcbfa6555fd90e71de61480c301c;p=oweals%2Ffstools.git block: make blockd_notify() return an int instead of void It allows improving block by handling blockd_notify() errors. Signed-off-by: Rafał Miłecki --- 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)