plugin: fix parsing libexec plugin output
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 3 Jul 2014 21:39:21 +0000 (23:39 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 3 Jul 2014 22:06:43 +0000 (00:06 +0200)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
plugin.c

index 687944d672d8cd6c383ba11fe4c09b781cb03f21..b75241aae1f82ce0a84b5d40c1c74b2e8c0577ed 100644 (file)
--- a/plugin.c
+++ b/plugin.c
@@ -108,12 +108,9 @@ rpc_plugin_call_finish_cb(struct blob_buf *blob, int stat, void *priv)
        {
                if (c->obj)
                {
-                       if (json_object_get_type(c->obj) == json_type_object ||
-                           json_object_get_type(c->obj) == json_type_array)
-                       {
-                               blobmsg_add_json_element(blob, NULL, c->obj);
+                       if (json_object_get_type(c->obj) == json_type_object &&
+                           blobmsg_add_object(blob, c->obj))
                                rv = UBUS_STATUS_OK;
-                       }
 
                        json_object_put(c->obj);
                }