summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-12-02 11:11:21 +0100
committerFelix Fietkau <nbd@openwrt.org>2013-12-02 11:11:21 +0100
commit262fede3e8c8c08c1eb0d1be9bf102232fb86cb9 (patch)
tree08bcb2dbad1cd9bda29581b3322ce64e2781b016
parent2fe8dbda01b6b21fd3cc8d2640ef55216f1fd17d (diff)
downloaduci-262fede3e8c8c08c1eb0d1be9bf102232fb86cb9.tar.gz
blob: use BLOBMSG_TYPE_STRING as a fallback type for arrays if no type was specified
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-rw-r--r--blob.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/blob.c b/blob.c
index 98c8d8a..ad72652 100644
--- a/blob.c
+++ b/blob.c
@@ -105,11 +105,16 @@ __uci_element_to_blob(struct blob_buf *b, struct uci_element *e,
types |= 1 << attr->type;
if (attr->type == BLOBMSG_TYPE_ARRAY) {
- if (!p->info)
- continue;
+ int element_type = 0;
+
+ if (p->info)
+ element_type = p->info[i].type;
+
+ if (!element_type)
+ element_type = BLOBMSG_TYPE_STRING;
array = blobmsg_open_array(b, attr->name);
- uci_array_to_blob(b, o, p->info[i].type);
+ uci_array_to_blob(b, o, element_type);
blobmsg_close_array(b, array);
ret++;
continue;