ubus: use network order in ubus message header fields
[project/ubus.git] / libubus.c
index e1e68d0..d52faff 100644 (file)
--- a/libubus.c
+++ b/libubus.c
@@ -105,6 +105,10 @@ ubus_process_msg(struct ubus_context *ctx, struct ubus_msghdr_buf *buf, int fd)
 
                ubus_process_obj_msg(ctx, buf);
                break;
+       case UBUS_MSG_MONITOR:
+               if (ctx->monitor_cb)
+                       ctx->monitor_cb(ctx, buf->hdr.seq, buf->data);
+               break;
        }
 }
 
@@ -354,6 +358,8 @@ struct ubus_context *ubus_connect(const char *path)
 void ubus_shutdown(struct ubus_context *ctx)
 {
        blob_buf_free(&b);
+       if (!ctx)
+               return;
        close(ctx->sock.fd);
        free(ctx->msgbuf.data);
 }