Browse Source

auc: fix some minor issues

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
lilik-openwrt-22.03
Daniel Golle 3 years ago
parent
commit
51f9df5b92
No known key found for this signature in database GPG Key ID: 5A8F39C31C3217CA
1 changed files with 13 additions and 5 deletions
  1. +13
    -5
      utils/auc/src/auc.c

+ 13
- 5
utils/auc/src/auc.c View File

@ -84,6 +84,7 @@ static char *distribution = NULL, *version = NULL, *revision = NULL;
static char *rootfs_type = NULL; static char *rootfs_type = NULL;
static int uptodate; static int uptodate;
static char *filename = NULL; static char *filename = NULL;
static void *dlh = NULL;
static int rc; static int rc;
struct branch { struct branch {
@ -429,7 +430,7 @@ static inline void release_replace_rc(char *ver)
tmp = strstr(ver, "-rc"); tmp = strstr(ver, "-rc");
if (tmp && strlen(tmp) > 3) { if (tmp && strlen(tmp) > 3) {
*tmp = '~'; *tmp = '~';
strcpy(tmp + 1, tmp + 3);
memmove(tmp + 1, tmp + 3, strlen(tmp + 3) + 1);
} }
} }
@ -972,7 +973,6 @@ static int server_request(const char *url, struct blob_buf *inbuf, struct blob_b
* ustream-ssl * ustream-ssl
*/ */
static int init_ustream_ssl(void) { static int init_ustream_ssl(void) {
void *dlh;
glob_t gl; glob_t gl;
int i; int i;
@ -1324,12 +1324,17 @@ static int add_upg_packages(struct blob_attr *reply, char *arch)
return -ENOMEM; return -ENOMEM;
avpk->name = strdup(blobmsg_name(cur)); avpk->name = strdup(blobmsg_name(cur));
if (!avpk->name)
if (!avpk->name) {
free(avpk);
return -ENOMEM; return -ENOMEM;
}
avpk->version = strdup(blobmsg_get_string(cur)); avpk->version = strdup(blobmsg_get_string(cur));
if (!avpk->version)
if (!avpk->version) {
free(avpk->name);
free(avpk);
return -ENOMEM; return -ENOMEM;
}
avpk->avl.key = avpk->name; avpk->avl.key = avpk->name;
if (avl_insert(&pkg_tree, &avpk->avl)) { if (avl_insert(&pkg_tree, &avpk->avl)) {
@ -1532,7 +1537,7 @@ static bool validate_sha256(char *filename, char *sha256str)
sha256close: sha256close:
fflush(f); fflush(f);
fclose(f);
pclose(f);
sha256free: sha256free:
free(cmd); free(cmd);
free(resstr); free(resstr);
@ -1955,6 +1960,9 @@ freeubus:
if (ucl) if (ucl)
uclient_free(ucl); uclient_free(ucl);
if (dlh)
dlclose(dlh);
if (rc) if (rc)
fprintf(stderr, "%s (%d)\n", strerror(-1 * rc), -1 * rc); fprintf(stderr, "%s (%d)\n", strerror(-1 * rc), -1 * rc);


Loading…
Cancel
Save