Fixed some warnings reported by clang.
This commit is contained in:
parent
ada3483acc
commit
dacbb2f22f
@ -275,7 +275,7 @@ rcv_load_file(rcv_t *rcv, const char *fname)
|
||||
static char *
|
||||
rcv_refs(rcv_t *rcv, const char *s, size_t len)
|
||||
{
|
||||
map_item_t item = map_new_item();
|
||||
map_item_t item;
|
||||
size_t i = 0, j = 0, k = 0, count = len*3;
|
||||
char *ref = calloc(count, sizeof(char));
|
||||
char *buf = calloc(count, sizeof(char));
|
||||
|
@ -283,7 +283,7 @@ exec_transaction(struct xbps_handle *xhp, int maxcols, bool yes, bool drun)
|
||||
}
|
||||
xbps_dbg_printf(xhp, "Empty transaction dictionary: %s\n",
|
||||
strerror(errno));
|
||||
return rv;
|
||||
goto out;
|
||||
}
|
||||
xbps_dbg_printf(xhp, "Dictionary before transaction happens:\n");
|
||||
xbps_dbg_printf_append(xhp, "%s",
|
||||
|
@ -47,7 +47,8 @@ index_add(struct xbps_handle *xhp, int argc, char **argv, bool force)
|
||||
struct xbps_repo *repo;
|
||||
struct stat st;
|
||||
const char *arch;
|
||||
char *sha256, *pkgver, *opkgver, *oarch, *pkgname, *tmprepodir, *repodir;
|
||||
char *sha256, *pkgver, *opkgver, *oarch, *pkgname;
|
||||
char *tmprepodir = NULL, *repodir = NULL;
|
||||
int rv = 0, ret = 0;
|
||||
bool flush = false, found = false;
|
||||
|
||||
@ -256,7 +257,7 @@ index_add(struct xbps_handle *xhp, int argc, char **argv, bool force)
|
||||
if (!repodata_flush(xhp, repodir, idx, idxfiles, idxmeta)) {
|
||||
fprintf(stderr, "%s: failed to write repodata: %s\n",
|
||||
_XBPS_RINDEX, strerror(errno));
|
||||
return -1;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
printf("index: %u packages registered.\n", xbps_dictionary_count(idx));
|
||||
@ -264,6 +265,11 @@ index_add(struct xbps_handle *xhp, int argc, char **argv, bool force)
|
||||
|
||||
out:
|
||||
index_unlock(il);
|
||||
|
||||
if (tmprepodir) {
|
||||
free(tmprepodir);
|
||||
}
|
||||
if (repodir) {
|
||||
free(repodir);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ index_clean(struct xbps_handle *xhp, const char *repodir)
|
||||
pthread_mutex_init(&cbd.mtx, NULL);
|
||||
|
||||
allkeys = xbps_dictionary_all_keys(idx);
|
||||
rv = xbps_array_foreach_cb_multi(xhp, allkeys, idx, idx_cleaner_cb, &cbd);
|
||||
(void)xbps_array_foreach_cb_multi(xhp, allkeys, idx, idx_cleaner_cb, &cbd);
|
||||
for (unsigned int x = 0; x < xbps_array_count(cbd.result); x++) {
|
||||
xbps_array_get_cstring(cbd.result, x, &keyname);
|
||||
printf("index-files: removed entry %s\n", keyname);
|
||||
@ -180,7 +180,7 @@ index_clean(struct xbps_handle *xhp, const char *repodir)
|
||||
cbd.idx = idx;
|
||||
cbd.result = xbps_array_create();
|
||||
allkeys = xbps_dictionary_all_keys(idxfiles);
|
||||
rv = xbps_array_foreach_cb_multi(xhp, allkeys, idxfiles, idxfiles_cleaner_cb, &cbd);
|
||||
(void)xbps_array_foreach_cb_multi(xhp, allkeys, idxfiles, idxfiles_cleaner_cb, &cbd);
|
||||
for (unsigned int x = 0; x < xbps_array_count(cbd.result); x++) {
|
||||
xbps_array_get_cstring(cbd.result, x, &keyname);
|
||||
printf("index-files: removed entry %s\n", keyname);
|
||||
|
@ -56,11 +56,13 @@ index_lock(struct xbps_handle *xhp)
|
||||
if (il->sem == SEM_FAILED) {
|
||||
fprintf(stderr, "%s: failed to create/open named "
|
||||
"semaphore: %s\n", _XBPS_RINDEX, strerror(errno));
|
||||
free(il);
|
||||
return NULL;
|
||||
}
|
||||
if (sem_wait(il->sem) == -1) {
|
||||
fprintf(stderr, "%s: failed to lock named semaphore: %s\n",
|
||||
_XBPS_RINDEX, strerror(errno));
|
||||
free(il);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -235,6 +235,7 @@ sign_repo(struct xbps_handle *xhp, const char *repodir,
|
||||
binpkg_sig_fd = creat(binpkg_sig, 0644);
|
||||
if (binpkg_sig_fd == -1) {
|
||||
fprintf(stderr, "failed to create %s: %s\n", binpkg_sig, strerror(errno));
|
||||
free(sig);
|
||||
free(binpkg_sig);
|
||||
continue;
|
||||
}
|
||||
@ -248,7 +249,6 @@ sign_repo(struct xbps_handle *xhp, const char *repodir,
|
||||
free(sig);
|
||||
free(binpkg_sig);
|
||||
close(binpkg_sig_fd);
|
||||
binpkg_fd = binpkg_sig_fd = -1;
|
||||
printf("signed successfully %s\n", pkgver);
|
||||
}
|
||||
xbps_object_iterator_release(iter);
|
||||
@ -290,8 +290,7 @@ sign_repo(struct xbps_handle *xhp, const char *repodir,
|
||||
|
||||
if (!repodata_flush(xhp, repodir, repo->idx, repo->idxfiles, meta)) {
|
||||
fprintf(stderr, "failed to write repodata: %s\n", strerror(errno));
|
||||
RSA_free(rsa);
|
||||
return -1;
|
||||
goto out;
|
||||
}
|
||||
printf("Signed repository (%u package%s)\n",
|
||||
xbps_dictionary_count(repo->idx),
|
||||
@ -300,12 +299,15 @@ sign_repo(struct xbps_handle *xhp, const char *repodir,
|
||||
out:
|
||||
index_unlock(il);
|
||||
|
||||
if (defprivkey) {
|
||||
free(defprivkey);
|
||||
}
|
||||
if (rsa) {
|
||||
RSA_free(rsa);
|
||||
rsa = NULL;
|
||||
}
|
||||
if (repo)
|
||||
if (repo) {
|
||||
xbps_repo_close(repo);
|
||||
|
||||
}
|
||||
return rv ? -1 : 0;
|
||||
}
|
||||
|
@ -280,7 +280,6 @@ xbps_init(struct xbps_handle *xhp)
|
||||
xbps_dbg_printf(xhp, "failed to read configuration file %s: %s\n",
|
||||
xhp->conffile, strerror(rv));
|
||||
xbps_dbg_printf(xhp, "Using built-in defaults\n");
|
||||
rv = 0;
|
||||
}
|
||||
/* Set rootdir */
|
||||
if (xhp->rootdir[0] == '\0') {
|
||||
|
@ -124,7 +124,7 @@ xbps_pubkey2fp(struct xbps_handle *xhp, xbps_data_t pubkey)
|
||||
memcpy(pEncoding, pSshHeader, 11);
|
||||
|
||||
index = SshEncodeBuffer(&pEncoding[11], eLen, eBytes);
|
||||
index = SshEncodeBuffer(&pEncoding[11 + index], nLen, nBytes);
|
||||
(void)SshEncodeBuffer(&pEncoding[11 + index], nLen, nBytes);
|
||||
|
||||
/*
|
||||
* Compute the RSA fingerprint (MD5).
|
||||
|
Loading…
Reference in New Issue
Block a user