X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fubus.git;a=blobdiff_plain;f=libubus-obj.c;fp=libubus-obj.c;h=c1931b314ef24b40f15d06ed6b0c16fcde17155e;hp=b3019652c52d73a1f9e1c6d24abb821161f2a198;hb=212ceb1b021bc0db19201894e1e9633fa6a25638;hpb=d57907c2b30170bdab7d59a4fad6e514f1861bbb diff --git a/libubus-obj.c b/libubus-obj.c index b301965..c1931b3 100644 --- a/libubus-obj.c +++ b/libubus-obj.c @@ -31,7 +31,8 @@ ubus_process_unsubscribe(struct ubus_context *ctx, struct ubus_msghdr *hdr, if (s->remove_cb) s->remove_cb(ctx, s, blob_get_u32(attrbuf[UBUS_ATTR_TARGET])); - close(fd); + if (fd >= 0) + close(fd); } static void @@ -45,7 +46,8 @@ ubus_process_notify(struct ubus_context *ctx, struct ubus_msghdr *hdr, if (obj->subscribe_cb) obj->subscribe_cb(ctx, obj); - close(fd); + if (fd >= 0) + close(fd); } static void ubus_process_invoke(struct ubus_context *ctx, struct ubus_msghdr *hdr,