xbps_xasprintf: do not return NULL anymore; remove checks for this.
This commit is contained in:
parent
0ab60b24c5
commit
d6735d5685
@ -373,7 +373,6 @@ process_entry_file(struct archive *ar, struct xentry *xe, const char *filematch)
|
||||
entry = archive_entry_new();
|
||||
assert(entry);
|
||||
p = xbps_xasprintf("%s/%s", destdir, xe->file);
|
||||
assert(p);
|
||||
archive_entry_set_pathname(entry, xe->file);
|
||||
archive_entry_copy_sourcepath(entry, p);
|
||||
|
||||
@ -710,7 +709,6 @@ main(int argc, char **argv)
|
||||
* Create a temp file to store archive data.
|
||||
*/
|
||||
tname = xbps_xasprintf(".xbps-pkg-XXXXXX");
|
||||
assert(tname);
|
||||
pkg_fd = mkstemp(tname);
|
||||
assert(pkg_fd != -1);
|
||||
/*
|
||||
@ -734,7 +732,6 @@ main(int argc, char **argv)
|
||||
* perspective it's atomic.
|
||||
*/
|
||||
binpkg = xbps_xasprintf("%s.%s.xbps", pkgver, arch);
|
||||
assert(binpkg);
|
||||
|
||||
(void)fsync(pkg_fd);
|
||||
myumask = umask(0);
|
||||
|
@ -269,9 +269,6 @@ parse_array_in_pkg_dictionary(FILE *f, prop_dictionary_t plistd,
|
||||
if (strcmp(keyname, optional_objs[x]) == 0) {
|
||||
optnode = xbps_xasprintf("[style=\"%s\"",
|
||||
cfprop);
|
||||
if (optnode == NULL)
|
||||
die("alloc optnode");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -495,8 +492,6 @@ main(int argc, char **argv)
|
||||
*/
|
||||
if (outfile == NULL) {
|
||||
outfile = xbps_xasprintf("%s.dot", argv[0]);
|
||||
if (outfile == NULL)
|
||||
die("alloc outfile");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -71,10 +71,6 @@ check_pkg_files(struct xbps_handle *xhp,
|
||||
while ((obj = prop_object_iterator_next(iter))) {
|
||||
prop_dictionary_get_cstring_nocopy(obj, "file", &file);
|
||||
path = xbps_xasprintf("%s/%s", xhp->rootdir, file);
|
||||
if (path == NULL) {
|
||||
prop_object_iterator_release(iter);
|
||||
return -1;
|
||||
}
|
||||
prop_dictionary_get_cstring_nocopy(obj,
|
||||
"sha256", &sha256);
|
||||
rv = xbps_file_hash_check(path, sha256);
|
||||
@ -124,10 +120,6 @@ check_pkg_files(struct xbps_handle *xhp,
|
||||
while ((obj = prop_object_iterator_next(iter))) {
|
||||
prop_dictionary_get_cstring_nocopy(obj, "file", &file);
|
||||
path = xbps_xasprintf("%s/%s", xhp->rootdir, file);
|
||||
if (path == NULL) {
|
||||
prop_object_iterator_release(iter);
|
||||
return -1;
|
||||
}
|
||||
if ((rv = access(path, R_OK)) == -1) {
|
||||
if (errno == ENOENT) {
|
||||
xbps_error_printf(
|
||||
|
@ -78,9 +78,6 @@ check_pkg_symlinks(struct xbps_handle *xhp,
|
||||
continue;
|
||||
}
|
||||
path = xbps_xasprintf("%s/%s", xhp->rootdir, file);
|
||||
if (path == NULL)
|
||||
return -1;
|
||||
|
||||
if ((buf = realpath(path, NULL)) == NULL) {
|
||||
xbps_error_printf("%s: broken symlink `%s': "
|
||||
"%s\n", pkgname, file, strerror(errno));
|
||||
@ -91,7 +88,6 @@ check_pkg_symlinks(struct xbps_handle *xhp,
|
||||
/* relative symlink target */
|
||||
dname = dirname(path);
|
||||
buf2 = xbps_xasprintf("%s/%s", dname, tgt);
|
||||
assert(buf2);
|
||||
buf3 = realpath(buf2, NULL);
|
||||
assert(buf3);
|
||||
free(buf2);
|
||||
|
@ -85,9 +85,6 @@ ownedby(struct xbps_handle *xhp, int npatterns, char **patterns)
|
||||
unsigned int i, count;
|
||||
|
||||
path = xbps_xasprintf("%s/metadata", xhp->metadir);
|
||||
if (path == NULL)
|
||||
return -1;
|
||||
|
||||
if ((dirp = opendir(path)) == NULL) {
|
||||
free(path);
|
||||
return -1;
|
||||
|
@ -161,7 +161,6 @@ cachedir_clean(struct xbps_handle *xhp)
|
||||
}
|
||||
/* Internalize props.plist dictionary from binary pkg */
|
||||
binpkg = xbps_xasprintf("%s/%s", xhp->cachedir, dp->d_name);
|
||||
assert(binpkg != NULL);
|
||||
pkg_propsd = xbps_dictionary_metadata_plist_by_url(binpkg,
|
||||
"./props.plist");
|
||||
if (pkg_propsd == NULL) {
|
||||
|
@ -44,7 +44,6 @@ remove_pkg(const char *repodir, const char *arch, const char *file)
|
||||
|
||||
/* Remove real binpkg */
|
||||
filepath = xbps_xasprintf("%s/%s/%s", repodir, arch, file);
|
||||
assert(filepath);
|
||||
if (remove(filepath) == -1) {
|
||||
rv = errno;
|
||||
xbps_error_printf("failed to remove old binpkg `%s': %s\n",
|
||||
@ -56,7 +55,6 @@ remove_pkg(const char *repodir, const char *arch, const char *file)
|
||||
|
||||
/* Remove symlink to binpkg */
|
||||
filepath = xbps_xasprintf("%s/%s", repodir, file);
|
||||
assert(filepath);
|
||||
if (remove(filepath) == -1) {
|
||||
rv = errno;
|
||||
xbps_error_printf("failed to remove old binpkg `%s': %s\n",
|
||||
|
@ -79,10 +79,7 @@ index_files_clean(struct xbps_handle *xhp, const char *repodir)
|
||||
/* pkg found, do nothing */
|
||||
continue;
|
||||
}
|
||||
if ((str = xbps_xasprintf("%s,%s", ipkgver, iarch)) == NULL) {
|
||||
rv = ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
str = xbps_xasprintf("%s,%s", ipkgver, iarch);
|
||||
if (!prop_array_add_cstring(obsoletes, str)) {
|
||||
free(str);
|
||||
rv = EINVAL;
|
||||
|
@ -206,7 +206,6 @@ index_add(struct xbps_handle *xhp, int argc, char **argv)
|
||||
*/
|
||||
buf = xbps_xasprintf("`%s' (%s)",
|
||||
oldpkgver, oldarch);
|
||||
assert(buf);
|
||||
rv = remove_pkg(repodir,
|
||||
oldarch, oldfilen);
|
||||
if (rv != 0) {
|
||||
@ -226,7 +225,6 @@ index_add(struct xbps_handle *xhp, int argc, char **argv)
|
||||
* index version.
|
||||
*/
|
||||
buf = xbps_xasprintf("`%s' (%s)", oldpkgver, oldarch);
|
||||
assert(buf);
|
||||
buf2 = strdup(oldpkgver);
|
||||
assert(buf2);
|
||||
rv = remove_pkg(repodir, oldarch, oldfilen);
|
||||
|
@ -124,10 +124,6 @@ xbps_fetch_file(struct xbps_handle *xhp,
|
||||
* Compute destination file path.
|
||||
*/
|
||||
destfile = xbps_xasprintf("%s/%s", outputdir, filename);
|
||||
if (destfile == NULL) {
|
||||
rv = -1;
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* Check if we have to resume a transfer.
|
||||
*/
|
||||
|
@ -145,7 +145,6 @@ xbps_init(struct xbps_handle *xhp)
|
||||
|
||||
buf = xbps_xasprintf("repositories = { %s }",
|
||||
xhp->repository);
|
||||
assert(buf);
|
||||
if ((rv = cfg_parse_buf(xhp->cfg, buf)) != 0)
|
||||
return rv;
|
||||
free(buf);
|
||||
|
@ -105,11 +105,6 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp,
|
||||
prop_dictionary_get_cstring_nocopy(obj2,
|
||||
"file", &cffile);
|
||||
buf = xbps_xasprintf(".%s", cffile);
|
||||
if (buf == NULL) {
|
||||
prop_object_iterator_release(iter2);
|
||||
rv = -1;
|
||||
goto out;
|
||||
}
|
||||
if (strcmp(entry_pname, buf) == 0) {
|
||||
prop_dictionary_get_cstring(obj2, "sha256",
|
||||
&sha256_orig);
|
||||
@ -138,10 +133,6 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp,
|
||||
while ((obj = prop_object_iterator_next(iter))) {
|
||||
prop_dictionary_get_cstring_nocopy(obj, "file", &cffile);
|
||||
buf = xbps_xasprintf(".%s", cffile);
|
||||
if (buf == NULL) {
|
||||
prop_object_iterator_release(iter);
|
||||
return -1;
|
||||
}
|
||||
if (strcmp(entry_pname, buf)) {
|
||||
free(buf);
|
||||
buf = NULL;
|
||||
@ -232,10 +223,6 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp,
|
||||
(strcmp(sha256_orig, sha256_new))) {
|
||||
buf = xbps_xasprintf(".%s.new-%s",
|
||||
cffile, version);
|
||||
if (buf == NULL) {
|
||||
rv = -1;
|
||||
break;
|
||||
}
|
||||
xbps_set_cb_state(xhp, XBPS_STATE_CONFIG_FILE,
|
||||
0, pkgname, version,
|
||||
"Installing new configuration file to "
|
||||
|
@ -113,9 +113,6 @@ xbps_configure_pkg(struct xbps_handle *xhp,
|
||||
|
||||
buf = xbps_xasprintf("%s/metadata/%s/INSTALL",
|
||||
XBPS_META_PATH, pkgname);
|
||||
if (buf == NULL)
|
||||
return ENOMEM;
|
||||
|
||||
if (chdir(xhp->rootdir) == -1) {
|
||||
xbps_set_cb_state(xhp, XBPS_STATE_CONFIGURE_FAIL,
|
||||
errno, pkgname, version,
|
||||
|
@ -57,7 +57,6 @@ xbps_pkg_find_conflicts(struct xbps_handle *xhp, prop_dictionary_t pkg_repod)
|
||||
"pkgver", &pkgver);
|
||||
buf = xbps_xasprintf("%s conflicts with "
|
||||
"installed pkg %s", repopkgver, pkgver);
|
||||
assert(buf != NULL);
|
||||
prop_array_add_cstring(trans_cflicts, buf);
|
||||
free(buf);
|
||||
continue;
|
||||
@ -72,7 +71,6 @@ xbps_pkg_find_conflicts(struct xbps_handle *xhp, prop_dictionary_t pkg_repod)
|
||||
"pkgver", &pkgver);
|
||||
buf = xbps_xasprintf("%s conflicts with "
|
||||
"%s in transaction", repopkgver, pkgver);
|
||||
assert(buf != NULL);
|
||||
prop_array_add_cstring(trans_cflicts, buf);
|
||||
free(buf);
|
||||
continue;
|
||||
|
@ -88,9 +88,6 @@ remove_pkg_metadata(struct xbps_handle *xhp,
|
||||
|
||||
metadir = xbps_xasprintf("%s/%s/metadata/%s", xhp->rootdir,
|
||||
XBPS_META_PATH, pkgname);
|
||||
if (metadir == NULL)
|
||||
return ENOMEM;
|
||||
|
||||
dirp = opendir(metadir);
|
||||
if (dirp == NULL) {
|
||||
free(metadir);
|
||||
@ -103,12 +100,6 @@ remove_pkg_metadata(struct xbps_handle *xhp,
|
||||
continue;
|
||||
|
||||
path = xbps_xasprintf("%s/%s", metadir, dp->d_name);
|
||||
if (path == NULL) {
|
||||
(void)closedir(dirp);
|
||||
free(metadir);
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
if (unlink(path) == -1) {
|
||||
xbps_set_cb_state(xhp, XBPS_STATE_PURGE_FAIL,
|
||||
errno, pkgname, version,
|
||||
@ -168,10 +159,6 @@ xbps_remove_pkg_files(struct xbps_handle *xhp,
|
||||
while ((obj = prop_object_iterator_next(iter))) {
|
||||
prop_dictionary_get_cstring_nocopy(obj, "file", &file);
|
||||
path = xbps_xasprintf("%s/%s", xhp->rootdir, file);
|
||||
if (path == NULL) {
|
||||
rv = ENOMEM;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((strcmp(key, "files") == 0) ||
|
||||
(strcmp(key, "conf_files") == 0)) {
|
||||
@ -282,16 +269,8 @@ xbps_remove_pkg(struct xbps_handle *xhp,
|
||||
|
||||
buf = xbps_xasprintf("%s/metadata/%s/REMOVE",
|
||||
XBPS_META_PATH, pkgname);
|
||||
if (buf == NULL) {
|
||||
rv = ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
pkgver = xbps_xasprintf("%s-%s", pkgname, version);
|
||||
if (pkgver == NULL) {
|
||||
rv = ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((rv = xbps_pkg_state_installed(xhp, pkgname, &state)) != 0)
|
||||
goto out;
|
||||
|
@ -71,7 +71,6 @@ again:
|
||||
|
||||
file = xbps_xasprintf(".%s",
|
||||
prop_string_cstring_nocopy(oldstr));
|
||||
assert(file);
|
||||
|
||||
if ((strcmp(array_str, "files") == 0) ||
|
||||
(strcmp(array_str, "conf_files") == 0)) {
|
||||
|
@ -71,10 +71,6 @@ extract_metafile(struct xbps_handle *xhp,
|
||||
}
|
||||
buf = xbps_xasprintf("%s/metadata/%s/%s",
|
||||
XBPS_META_PATH, pkgname, file);
|
||||
if (buf == NULL) {
|
||||
free(pkgname);
|
||||
return ENOMEM;
|
||||
}
|
||||
archive_entry_set_pathname(entry, buf);
|
||||
dirc = strdup(buf);
|
||||
if (dirc == NULL) {
|
||||
@ -133,10 +129,6 @@ remove_metafile(struct xbps_handle *xhp,
|
||||
}
|
||||
buf = xbps_xasprintf("%s/metadata/%s/%s",
|
||||
XBPS_META_PATH, pkgname, file);
|
||||
if (buf == NULL) {
|
||||
free(pkgname);
|
||||
return ENOMEM;
|
||||
}
|
||||
if (unlink(buf) == -1) {
|
||||
if (errno && errno != ENOENT) {
|
||||
xbps_set_cb_state(xhp, XBPS_STATE_UNPACK_FAIL,
|
||||
@ -291,10 +283,6 @@ unpack_archive(struct xbps_handle *xhp,
|
||||
*/
|
||||
buf = xbps_xasprintf("%s/metadata/%s/INSTALL",
|
||||
XBPS_META_PATH, pkgname);
|
||||
if (buf == NULL) {
|
||||
rv = ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
rv = extract_metafile(xhp, ar, entry,
|
||||
"INSTALL", pkgver, true, flags);
|
||||
if (rv != 0)
|
||||
@ -470,7 +458,6 @@ unpack_archive(struct xbps_handle *xhp,
|
||||
assert(buf2);
|
||||
dname = dirname(buf2);
|
||||
p2 = xbps_xasprintf("%s/%s", dname, tgtlnk);
|
||||
assert(p2);
|
||||
free(buf2);
|
||||
} else {
|
||||
p2 = strdup(tgtlnk);
|
||||
@ -539,7 +526,6 @@ unpack_archive(struct xbps_handle *xhp,
|
||||
* file but renaming it to <file>.old.
|
||||
*/
|
||||
buf = xbps_xasprintf("%s.old", entry_pname);
|
||||
assert(buf);
|
||||
(void)rename(entry_pname, buf);
|
||||
free(buf);
|
||||
buf = NULL;
|
||||
@ -593,10 +579,6 @@ unpack_archive(struct xbps_handle *xhp,
|
||||
*/
|
||||
pkgfilesd = xbps_xasprintf("%s/metadata/%s/%s",
|
||||
XBPS_META_PATH, pkgname, XBPS_PKGFILES);
|
||||
if (pkgfilesd == NULL) {
|
||||
rv = ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
if (skip_obsoletes || preserve || (!softreplace && !update))
|
||||
goto out1;
|
||||
/*
|
||||
@ -631,10 +613,6 @@ out1:
|
||||
* Create pkg metadata directory if doesn't exist.
|
||||
*/
|
||||
buf = xbps_xasprintf("%s/metadata/%s", XBPS_META_PATH, pkgname);
|
||||
if (buf == NULL) {
|
||||
rv = ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
if (access(buf, R_OK|X_OK) == -1) {
|
||||
if (xbps_mkpath(buf, 0755) == -1) {
|
||||
xbps_set_cb_state(xhp, XBPS_STATE_UNPACK_FAIL,
|
||||
@ -661,10 +639,6 @@ out1:
|
||||
}
|
||||
pkgpropsd = xbps_xasprintf("%s/metadata/%s/%s",
|
||||
XBPS_META_PATH, pkgname, XBPS_PKGPROPS);
|
||||
if (pkgpropsd == NULL) {
|
||||
rv = ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
if (!prop_dictionary_externalize_to_file(propsd, pkgpropsd)) {
|
||||
rv = errno;
|
||||
xbps_set_cb_state(xhp, XBPS_STATE_UNPACK_FAIL,
|
||||
|
@ -88,8 +88,6 @@ xbps_pkgdb_update(struct xbps_handle *xhp, bool flush)
|
||||
return cached_rv;
|
||||
|
||||
plist = xbps_xasprintf("%s/%s", xhp->metadir, XBPS_PKGDB);
|
||||
assert(plist);
|
||||
|
||||
if (xhp->pkgdb && flush) {
|
||||
pkgdb_storage = prop_array_internalize_from_zfile(plist);
|
||||
if (pkgdb_storage == NULL ||
|
||||
|
@ -280,8 +280,6 @@ xbps_dictionary_from_metadata_plist(struct xbps_handle *xhp,
|
||||
savedpkgname = pkgname;
|
||||
plistf = xbps_xasprintf("%s/metadata/%s/%s", xhp->metadir,
|
||||
savedpkgname, plist);
|
||||
if (plistf == NULL)
|
||||
return NULL;
|
||||
|
||||
if (access(plistf, R_OK) == -1) {
|
||||
pkgd = xbps_find_virtualpkg_dict_installed(xhp, pkgname, false);
|
||||
@ -294,8 +292,6 @@ xbps_dictionary_from_metadata_plist(struct xbps_handle *xhp,
|
||||
"pkgname", &savedpkgname);
|
||||
plistf = xbps_xasprintf("%s/metadata/%s/%s",
|
||||
xhp->metadir, savedpkgname, plist);
|
||||
if (plistf == NULL)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,6 @@ find_virtualpkg_user_in_conf(struct xbps_handle *xhp,
|
||||
vpkgver = cfg_getnstr(sec, "targets", j);
|
||||
if (strchr(vpkgver, '_') == NULL) {
|
||||
tmp = xbps_xasprintf("%s_1", vpkgver);
|
||||
assert(tmp != NULL);
|
||||
vpkgname = xbps_pkg_name(tmp);
|
||||
free(tmp);
|
||||
} else {
|
||||
|
@ -71,7 +71,6 @@ xbps_match_any_virtualpkg_in_rundeps(prop_array_t rundeps,
|
||||
prop_array_get_cstring_nocopy(provides, i, &vpkgver);
|
||||
if (strchr(vpkgver, '_') == NULL) {
|
||||
tmp = xbps_xasprintf("%s_1", vpkgver);
|
||||
assert(tmp != NULL);
|
||||
vpkgver = tmp;
|
||||
}
|
||||
for (x = 0; x < prop_array_count(rundeps); x++) {
|
||||
@ -117,7 +116,6 @@ match_string_in_array(prop_array_t array, const char *str, int mode)
|
||||
pkgdep = prop_string_cstring_nocopy(obj);
|
||||
if (strchr(pkgdep, '_') == NULL) {
|
||||
tmp = xbps_xasprintf("%s_1", pkgdep);
|
||||
assert(tmp != NULL);
|
||||
curpkgname = xbps_pkg_name(tmp);
|
||||
free(tmp);
|
||||
} else {
|
||||
@ -136,7 +134,6 @@ match_string_in_array(prop_array_t array, const char *str, int mode)
|
||||
pkgdep = prop_string_cstring_nocopy(obj);
|
||||
if (strchr(pkgdep, '_') == NULL) {
|
||||
tmp = xbps_xasprintf("%s_1", pkgdep);
|
||||
assert(tmp != NULL);
|
||||
pkgdep = tmp;
|
||||
}
|
||||
if (xbps_pkgpattern_match(pkgdep, str)) {
|
||||
@ -153,7 +150,6 @@ match_string_in_array(prop_array_t array, const char *str, int mode)
|
||||
pkgdep = prop_string_cstring_nocopy(obj);
|
||||
if (strchr(pkgdep, '_') == NULL) {
|
||||
tmp = xbps_xasprintf("%s_1", pkgdep);
|
||||
assert(tmp != NULL);
|
||||
pkgdep = tmp;
|
||||
}
|
||||
if (xbps_pkgpattern_match(str, pkgdep)) {
|
||||
|
@ -70,9 +70,6 @@ xbps_get_remote_repo_string(const char *uri)
|
||||
url->host, url->doc);
|
||||
|
||||
fetchFreeURL(url);
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < strlen(p); i++) {
|
||||
if (p[i] == '.' || p[i] == '/' || p[i] == ':')
|
||||
p[i] = '_';
|
||||
@ -128,28 +125,16 @@ xbps_repository_sync_pkg_index(struct xbps_handle *xhp,
|
||||
* Remote repository plist index full URL.
|
||||
*/
|
||||
rpidx = xbps_xasprintf("%s/%s", uri, plistf);
|
||||
if (rpidx == NULL) {
|
||||
rv = -1;
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* Save temporary file in metadir, and rename if it
|
||||
* was downloaded successfully.
|
||||
*/
|
||||
tmp_metafile = xbps_xasprintf("%s/%s", xhp->metadir, plistf);
|
||||
if (tmp_metafile == NULL) {
|
||||
rv = -1;
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* Full path to repository directory to store the plist
|
||||
* index file.
|
||||
*/
|
||||
lrepodir = xbps_xasprintf("%s/%s", xhp->metadir, uri_fixedp);
|
||||
if (lrepodir == NULL) {
|
||||
rv = -1;
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* If directory exists probably the plist index file
|
||||
* was downloaded previously...
|
||||
@ -195,10 +180,6 @@ xbps_repository_sync_pkg_index(struct xbps_handle *xhp,
|
||||
prop_object_release(array);
|
||||
|
||||
lrepofile = xbps_xasprintf("%s/%s", lrepodir, plistf);
|
||||
if (lrepofile == NULL) {
|
||||
rv = -1;
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* Create local repodir to store plist index file.
|
||||
*/
|
||||
|
@ -163,14 +163,12 @@ xbps_transaction_package_replace(struct xbps_handle *xhp)
|
||||
buf = xbps_xasprintf("%s/%s/metadata/%s/%s",
|
||||
xhp->rootdir, XBPS_META_PATH, curpkgname,
|
||||
XBPS_PKGFILES);
|
||||
assert(buf != NULL);
|
||||
filesd = prop_dictionary_internalize_from_zfile(buf);
|
||||
free(buf);
|
||||
assert(filesd != NULL);
|
||||
buf = xbps_xasprintf("%s/%s/metadata/%s/%s",
|
||||
xhp->rootdir, XBPS_META_PATH, pkgname,
|
||||
XBPS_PKGFILES);
|
||||
assert(buf != NULL);
|
||||
dirc = strdup(buf);
|
||||
assert(dirc != NULL);
|
||||
dname = dirname(dirc);
|
||||
|
@ -346,7 +346,6 @@ xbps_transaction_sort_pkg_deps(struct xbps_handle *xhp)
|
||||
j, &vpkgdep);
|
||||
if (strchr(vpkgdep, '_') == NULL) {
|
||||
vpkg = xbps_xasprintf("%s_1", vpkgdep);
|
||||
assert(vpkg);
|
||||
vpkgname = xbps_pkg_name(vpkg);
|
||||
free(vpkg);
|
||||
} else {
|
||||
|
@ -245,9 +245,6 @@ xbps_path_from_repository_uri(struct xbps_handle *xhp,
|
||||
* First check if binpkg is available in cachedir.
|
||||
*/
|
||||
lbinpkg = xbps_xasprintf("%s/%s", xhp->cachedir, filen);
|
||||
if (lbinpkg == NULL)
|
||||
return NULL;
|
||||
|
||||
if (access(lbinpkg, R_OK) == 0)
|
||||
return lbinpkg;
|
||||
|
||||
@ -294,14 +291,15 @@ char *
|
||||
xbps_xasprintf(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *buf;
|
||||
char *buf = NULL;
|
||||
|
||||
va_start(ap, fmt);
|
||||
if (vasprintf(&buf, fmt, ap) == -1) {
|
||||
va_end(ap);
|
||||
return NULL;
|
||||
assert(buf);
|
||||
}
|
||||
va_end(ap);
|
||||
assert(buf);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
@ -196,7 +196,6 @@ xbps_file_hash_check_dictionary(struct xbps_handle *xhp,
|
||||
rv = xbps_file_hash_check(file, sha256d);
|
||||
} else {
|
||||
buf = xbps_xasprintf("%s/%s", xhp->rootdir, file);
|
||||
assert(buf != NULL);
|
||||
rv = xbps_file_hash_check(buf, sha256d);
|
||||
free(buf);
|
||||
}
|
||||
|
@ -70,7 +70,6 @@ ATF_TC_BODY(find_virtualpkg_dict_installed_test, tc)
|
||||
/* get test source dir */
|
||||
tcsdir = atf_tc_get_config_var(tc, "srcdir");
|
||||
cffile = xbps_xasprintf("%s/xbps.conf", tcsdir);
|
||||
ATF_REQUIRE(cffile != NULL);
|
||||
|
||||
/* initialize xbps */
|
||||
memset(&xh, 0, sizeof(xh));
|
||||
|
Loading…
Reference in New Issue
Block a user