Browse Source

auc: update to version 0.1.7

No longer fail in case a package is part of multiple lists (which may
happen temporarily in case it becomes 'nonshared').
Bump version to prepare for sync accross branches.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Daniel Golle 1 month ago
parent
commit
9150e82768
2 changed files with 17 additions and 4 deletions
  1. 1 1
      utils/auc/Makefile
  2. 16 3
      utils/auc/src/auc.c

+ 1 - 1
utils/auc/Makefile

@@ -5,7 +5,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=auc
-PKG_VERSION:=0.1.6
+PKG_VERSION:=0.1.7
 PKG_RELEASE:=$(AUTORELEASE)
 PKG_LICENSE:=GPL-3.0
 

+ 16 - 3
utils/auc/src/auc.c

@@ -1251,11 +1251,25 @@ static int add_upg_packages(struct blob_attr *reply, char *arch)
 
 	blobmsg_for_each_attr(cur, packages, rem) {
 		avpk = malloc(sizeof(struct avl_pkg));
+		if (!avpk)
+			return -ENOMEM;
+
 		avpk->name = strdup(blobmsg_name(cur));
+		if (!avpk->name)
+			return -ENOMEM;
+
 		avpk->version = strdup(blobmsg_get_string(cur));
+		if (!avpk->version)
+			return -ENOMEM;
+
 		avpk->avl.key = avpk->name;
-		if (!avpk->name || !avpk->version || avl_insert(&pkg_tree, &avpk->avl)) {
-			fprintf(stderr, "failed to insert package %s (%s)!\n", blobmsg_name(cur), blobmsg_get_string(cur));
+		if (avl_insert(&pkg_tree, &avpk->avl)) {
+
+#ifdef AUC_DEBUG
+			if (debug)
+				fprintf(stderr, "failed to insert package %s (%s)!\n", blobmsg_name(cur), blobmsg_get_string(cur));
+#endif
+
 			if (avpk->name)
 				free(avpk->name);
 
@@ -1263,7 +1277,6 @@ static int add_upg_packages(struct blob_attr *reply, char *arch)
 				free(avpk->version);
 
 			free(avpk);
-			return -ENOMEM;
 		}
 	}