summaryrefslogtreecommitdiff
path: root/utils/auc
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2021-08-15 02:14:20 +0100
committerDaniel Golle <daniel@makrotopia.org>2021-08-15 02:33:53 +0100
commitb1d38e7ab3402e66bedc43dfd9d2fb7e41074511 (patch)
treee9fb7fd0e4ed215b29c3913a37df03c1dc836e48 /utils/auc
parent51f9a12a54dc2e7abcf9028490114d8bd926ac88 (diff)
auc: update to version 0.2.0
* support for ASU server post commit aparcar/asu@bac6de18 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'utils/auc')
-rw-r--r--utils/auc/Makefile2
-rw-r--r--utils/auc/src/auc.c11
2 files changed, 10 insertions, 3 deletions
diff --git a/utils/auc/Makefile b/utils/auc/Makefile
index c7badf71f..c8f1d9187 100644
--- a/utils/auc/Makefile
+++ b/utils/auc/Makefile
@@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=auc
-PKG_VERSION:=0.1.9
+PKG_VERSION:=0.2.0
PKG_RELEASE:=$(AUTORELEASE)
PKG_LICENSE:=GPL-3.0
diff --git a/utils/auc/src/auc.c b/utils/auc/src/auc.c
index 00d813b05..8e8ac14f0 100644
--- a/utils/auc/src/auc.c
+++ b/utils/auc/src/auc.c
@@ -1202,6 +1202,7 @@ static int request_branches(bool only_active)
struct blob_attr *tb[__REPLY_MAX];
int rem;
char url[256];
+ struct blob_attr *data;
blobmsg_buf_init(&brbuf);
snprintf(url, sizeof(url), "%s/%s/%s%s", serverurl, API_JSON,
@@ -1214,10 +1215,16 @@ static int request_branches(bool only_active)
blobmsg_parse(reply_policy, __REPLY_MAX, tb, blob_data(brbuf.head), blob_len(brbuf.head));
- if (!tb[REPLY_ARRAY])
+ /* newer server API replies OBJECT, older API replies ARRAY... */
+ if ((!tb[REPLY_ARRAY] && !tb[REPLY_OBJECT]))
return -ENODATA;
- blobmsg_for_each_attr(cur, tb[REPLY_ARRAY], rem)
+ if (tb[REPLY_OBJECT])
+ data = tb[REPLY_OBJECT];
+ else
+ data = tb[REPLY_ARRAY];
+
+ blobmsg_for_each_attr(cur, data, rem)
process_branch(cur, only_active);
blob_buf_free(&brbuf);