Extensively verified that all functions have its return value

checked for any spurious error, this should make the core more safer :-)

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091123094651-5prw0bkqmt3y8h23
This commit is contained in:
Juan RP
2009-11-23 09:46:51 +00:00
parent ea468f850f
commit bf82b6512d
17 changed files with 416 additions and 105 deletions

View File

@ -64,8 +64,16 @@ xbps_check_pkg_integrity_all(void)
return ENOENT; return ENOENT;
while ((obj = prop_object_iterator_next(iter)) != NULL) { while ((obj = prop_object_iterator_next(iter)) != NULL) {
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname); if (!prop_dictionary_get_cstring_nocopy(obj,
prop_dictionary_get_cstring_nocopy(obj, "version", &version); "pkgname", &pkgname)) {
prop_object_iterator_release(iter);
return errno;
}
if (!prop_dictionary_get_cstring_nocopy(obj,
"version", &version)) {
prop_object_iterator_release(iter);
return errno;
}
printf("Checking %s-%s ...\n", pkgname, version); printf("Checking %s-%s ...\n", pkgname, version);
if ((rv = xbps_check_pkg_integrity(pkgname)) != 0) if ((rv = xbps_check_pkg_integrity(pkgname)) != 0)
nbrokenpkgs++; nbrokenpkgs++;
@ -177,7 +185,12 @@ xbps_check_pkg_integrity(const char *pkgname)
goto out2; goto out2;
} }
while ((obj = prop_object_iterator_next(iter))) { while ((obj = prop_object_iterator_next(iter))) {
prop_dictionary_get_cstring_nocopy(obj, "file", &file); if (!prop_dictionary_get_cstring_nocopy(obj,
"file", &file)) {
prop_object_iterator_release(iter);
rv = errno;
goto out2;
}
path = xbps_xasprintf("%s/%s", path = xbps_xasprintf("%s/%s",
xbps_get_rootdir(), file); xbps_get_rootdir(), file);
if (path == NULL) { if (path == NULL) {
@ -185,8 +198,13 @@ xbps_check_pkg_integrity(const char *pkgname)
rv = errno; rv = errno;
goto out2; goto out2;
} }
prop_dictionary_get_cstring_nocopy(obj, if (!prop_dictionary_get_cstring_nocopy(obj,
"sha256", &sha256); "sha256", &sha256)) {
free(path);
prop_object_iterator_release(iter);
rv = errno;
goto out2;
}
rv = xbps_check_file_hash(path, sha256); rv = xbps_check_file_hash(path, sha256);
switch (rv) { switch (rv) {
case 0: case 0:
@ -227,7 +245,12 @@ xbps_check_pkg_integrity(const char *pkgname)
goto out2; goto out2;
} }
while ((obj = prop_object_iterator_next(iter))) { while ((obj = prop_object_iterator_next(iter))) {
prop_dictionary_get_cstring_nocopy(obj, "file", &file); if (!prop_dictionary_get_cstring_nocopy(obj,
"file", &file)) {
prop_object_iterator_release(iter);
rv = errno;
goto out2;
}
path = xbps_xasprintf("%s/%s", path = xbps_xasprintf("%s/%s",
xbps_get_rootdir(), file); xbps_get_rootdir(), file);
if (path == NULL) { if (path == NULL) {
@ -264,6 +287,11 @@ xbps_check_pkg_integrity(const char *pkgname)
} }
while ((obj = prop_object_iterator_next(iter))) { while ((obj = prop_object_iterator_next(iter))) {
reqpkg = prop_string_cstring_nocopy(obj); reqpkg = prop_string_cstring_nocopy(obj);
if (reqpkg == NULL) {
prop_object_iterator_release(iter);
rv = EINVAL;
goto out2;
}
if (xbps_check_is_installed_pkg(reqpkg) <= 0) { if (xbps_check_is_installed_pkg(reqpkg) <= 0) {
rv = ENOENT; rv = ENOENT;
printf("%s: dependency not satisfied: %s\n", printf("%s: dependency not satisfied: %s\n",

View File

@ -82,7 +82,10 @@ check_pkg_hashes(prop_object_iterator_t iter)
printf("Checking binary package file(s) integrity...\n"); printf("Checking binary package file(s) integrity...\n");
while ((obj = prop_object_iterator_next(iter)) != NULL) { while ((obj = prop_object_iterator_next(iter)) != NULL) {
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname); if (!prop_dictionary_get_cstring_nocopy(obj,
"pkgname", &pkgname))
return errno;
state = 0; state = 0;
if (xbps_get_pkg_state_dictionary(obj, &state) != 0) if (xbps_get_pkg_state_dictionary(obj, &state) != 0)
return EINVAL; return EINVAL;
@ -90,8 +93,12 @@ check_pkg_hashes(prop_object_iterator_t iter)
if (state == XBPS_PKG_STATE_UNPACKED) if (state == XBPS_PKG_STATE_UNPACKED)
continue; continue;
prop_dictionary_get_cstring_nocopy(obj, "repository", &repoloc); if (!prop_dictionary_get_cstring_nocopy(obj,
prop_dictionary_get_cstring_nocopy(obj, "filename", &filename); "repository", &repoloc))
return errno;
if (!prop_dictionary_get_cstring_nocopy(obj,
"filename", &filename))
return errno;
rv = xbps_check_pkg_file_hash(obj, repoloc); rv = xbps_check_pkg_file_hash(obj, repoloc);
if (rv != 0 && rv != ERANGE) { if (rv != 0 && rv != ERANGE) {
printf("Unexpected error while checking hash for " printf("Unexpected error while checking hash for "
@ -118,16 +125,24 @@ download_package_list(prop_object_iterator_t iter)
printf("Downloading binary package file(s)...\n"); printf("Downloading binary package file(s)...\n");
while ((obj = prop_object_iterator_next(iter)) != NULL) { while ((obj = prop_object_iterator_next(iter)) != NULL) {
prop_dictionary_get_cstring_nocopy(obj, "repository", &repoloc); if (!prop_dictionary_get_cstring_nocopy(obj,
"repository", &repoloc))
return errno;
/* /*
* Skip packages in local repositories. * Skip packages in local repositories.
*/ */
if (!xbps_check_is_repo_string_remote(repoloc)) if (!xbps_check_is_repo_string_remote(repoloc))
continue; continue;
prop_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver); if (!prop_dictionary_get_cstring_nocopy(obj,
prop_dictionary_get_cstring_nocopy(obj, "filename", &filename); "pkgver", &pkgver))
prop_dictionary_get_cstring_nocopy(obj, "architecture", &arch); return errno;
if (!prop_dictionary_get_cstring_nocopy(obj,
"filename", &filename))
return errno;
if (!prop_dictionary_get_cstring_nocopy(obj,
"architecture", &arch))
return errno;
repoloc_trans = xbps_get_remote_repo_string(repoloc); repoloc_trans = xbps_get_remote_repo_string(repoloc);
if (repoloc_trans == NULL) if (repoloc_trans == NULL)
@ -139,14 +154,12 @@ download_package_list(prop_object_iterator_t iter)
free(repoloc_trans); free(repoloc_trans);
return errno; return errno;
} }
lbinfile = xbps_xasprintf("%s/%s", savedir, filename); lbinfile = xbps_xasprintf("%s/%s", savedir, filename);
if (lbinfile == NULL) { if (lbinfile == NULL) {
free(repoloc_trans); free(repoloc_trans);
free(savedir); free(savedir);
return errno; return errno;
} }
if (access(lbinfile, R_OK) == 0) { if (access(lbinfile, R_OK) == 0) {
free(savedir); free(savedir);
free(lbinfile); free(lbinfile);
@ -182,7 +195,10 @@ change_repodir:
if (savedir == NULL) if (savedir == NULL)
return errno; return errno;
prop_dictionary_set_cstring(obj, "repository", savedir); if (!prop_dictionary_set_cstring(obj, "repository", savedir)) {
free(savedir);
return errno;
}
free(savedir); free(savedir);
} }
prop_object_iterator_reset(iter); prop_object_iterator_reset(iter);
@ -199,8 +215,12 @@ show_package_list(prop_object_iterator_t iter, const char *match)
bool first = false; bool first = false;
while ((obj = prop_object_iterator_next(iter)) != NULL) { while ((obj = prop_object_iterator_next(iter)) != NULL) {
prop_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver); if (!prop_dictionary_get_cstring_nocopy(obj,
prop_dictionary_get_cstring_nocopy(obj, "trans-action", &tract); "pkgver", &pkgver))
return;
if (!prop_dictionary_get_cstring_nocopy(obj,
"trans-action", &tract))
return;
if (strcmp(match, tract)) if (strcmp(match, tract))
continue; continue;
@ -233,17 +253,24 @@ show_transaction_sizes(prop_object_iterator_t iter)
* installed and check the file hash. * installed and check the file hash.
*/ */
while ((obj = prop_object_iterator_next(iter)) != NULL) { while ((obj = prop_object_iterator_next(iter)) != NULL) {
prop_dictionary_get_uint64(obj, "filename-size", &tsize); if (!prop_dictionary_get_uint64(obj, "filename-size", &tsize))
return errno;
dlsize += tsize; dlsize += tsize;
tsize = 0; tsize = 0;
prop_dictionary_get_uint64(obj, "installed_size", &tsize); if (!prop_dictionary_get_uint64(obj, "installed_size", &tsize))
return errno;
instsize += tsize; instsize += tsize;
tsize = 0; tsize = 0;
} }
prop_object_iterator_reset(iter); prop_object_iterator_reset(iter);
while ((obj = prop_object_iterator_next(iter))) { while ((obj = prop_object_iterator_next(iter))) {
prop_dictionary_get_cstring_nocopy(obj, "trans-action", &tract); if (!prop_dictionary_get_cstring_nocopy(obj,
"trans-action", &tract))
return errno;
if (strcmp(tract, "install") == 0) if (strcmp(tract, "install") == 0)
trans_inst = true; trans_inst = true;
else if (strcmp(tract, "update") == 0) else if (strcmp(tract, "update") == 0)
@ -384,8 +411,11 @@ xbps_exec_transaction(const char *pkgname, bool force, bool update)
goto out2; goto out2;
} }
prop_dictionary_get_cstring_nocopy(trans->dict, if (!prop_dictionary_get_cstring_nocopy(trans->dict,
"origin", &trans->originpkgname); "origin", &trans->originpkgname)) {
rv = errno;
goto out2;
}
if (update) { if (update) {
/* /*
@ -434,6 +464,9 @@ replace_packages(prop_object_iterator_t iter, const char *pkgver)
*/ */
while ((obj = prop_object_iterator_next(iter))) { while ((obj = prop_object_iterator_next(iter))) {
reppkgn = prop_string_cstring_nocopy(obj); reppkgn = prop_string_cstring_nocopy(obj);
if (reppkgn == NULL)
return errno;
instd = xbps_find_pkg_installed_from_plist(reppkgn); instd = xbps_find_pkg_installed_from_plist(reppkgn);
if (instd == NULL) if (instd == NULL)
continue; continue;
@ -505,12 +538,22 @@ exec_transaction(struct transaction *trans)
* Iterate over the transaction dictionary. * Iterate over the transaction dictionary.
*/ */
while ((obj = prop_object_iterator_next(trans->iter)) != NULL) { while ((obj = prop_object_iterator_next(trans->iter)) != NULL) {
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname); if (!prop_dictionary_get_cstring_nocopy(obj,
prop_dictionary_get_cstring_nocopy(obj, "version", &version); "pkgname", &pkgname))
prop_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver); return errno;
if (!prop_dictionary_get_cstring_nocopy(obj,
"version", &version))
return errno;
if (!prop_dictionary_get_cstring_nocopy(obj,
"pkgver", &pkgver))
return errno;
prop_dictionary_get_bool(obj, "essential", &essential); prop_dictionary_get_bool(obj, "essential", &essential);
prop_dictionary_get_cstring_nocopy(obj, "filename", &filename); if (!prop_dictionary_get_cstring_nocopy(obj,
prop_dictionary_get_cstring_nocopy(obj, "trans-action", &tract); "filename", &filename))
return errno;
if (!prop_dictionary_get_cstring_nocopy(obj,
"trans-action", &tract))
return errno;
replaces_iter = xbps_get_array_iter_from_dict(obj, "replaces"); replaces_iter = xbps_get_array_iter_from_dict(obj, "replaces");
/* /*
@ -556,11 +599,17 @@ exec_transaction(struct transaction *trans)
return EINVAL; return EINVAL;
} }
prop_dictionary_get_cstring_nocopy(instpkgd, if (!prop_dictionary_get_cstring_nocopy(instpkgd,
"version", &instver); "version", &instver)) {
prop_object_release(instpkgd);
return errno;
}
autoinst = false; autoinst = false;
prop_dictionary_get_bool(instpkgd, "automatic-install", if (!prop_dictionary_get_bool(instpkgd,
&autoinst); "automatic-install", &autoinst)) {
prop_object_release(instpkgd);
return errno;
}
prop_object_release(instpkgd); prop_object_release(instpkgd);
/* /*
@ -618,8 +667,12 @@ exec_transaction(struct transaction *trans)
* Configure all unpacked packages. * Configure all unpacked packages.
*/ */
while ((obj = prop_object_iterator_next(trans->iter)) != NULL) { while ((obj = prop_object_iterator_next(trans->iter)) != NULL) {
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname); if (!prop_dictionary_get_cstring_nocopy(obj,
prop_dictionary_get_cstring_nocopy(obj, "version", &version); "pkgname", &pkgname))
return errno;
if (!prop_dictionary_get_cstring_nocopy(obj,
"version", &version))
return errno;
if ((rv = xbps_configure_pkg(pkgname, version, false)) != 0) { if ((rv = xbps_configure_pkg(pkgname, version, false)) != 0) {
printf("Error configuring package %s (%s)\n", printf("Error configuring package %s (%s)\n",
pkgname, strerror(rv)); pkgname, strerror(rv));

View File

@ -68,7 +68,11 @@ xbps_autoremove_pkgs(void)
printf("The following packages were installed automatically\n" printf("The following packages were installed automatically\n"
"(as dependencies) and aren't needed anymore:\n\n"); "(as dependencies) and aren't needed anymore:\n\n");
while ((obj = prop_object_iterator_next(iter)) != NULL) { while ((obj = prop_object_iterator_next(iter)) != NULL) {
prop_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver); if (!prop_dictionary_get_cstring_nocopy(obj,
"pkgver", &pkgver)) {
rv = errno;
goto out2;
}
cols += strlen(pkgver) + 4; cols += strlen(pkgver) + 4;
if (cols <= 80) { if (cols <= 80) {
if (first == false) { if (first == false) {
@ -90,8 +94,16 @@ xbps_autoremove_pkgs(void)
} }
while ((obj = prop_object_iterator_next(iter)) != NULL) { while ((obj = prop_object_iterator_next(iter)) != NULL) {
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname); if (!prop_dictionary_get_cstring_nocopy(obj,
prop_dictionary_get_cstring_nocopy(obj, "version", &version); "pkgname", &pkgname)) {
rv = errno;
goto out2;
}
if (!prop_dictionary_get_cstring_nocopy(obj,
"version", &version)) {
rv = errno;
goto out;
}
printf("Removing package %s-%s ...\n", pkgname, version); printf("Removing package %s-%s ...\n", pkgname, version);
if ((rv = xbps_remove_pkg(pkgname, version, false)) != 0) if ((rv = xbps_remove_pkg(pkgname, version, false)) != 0)
goto out2; goto out2;
@ -120,7 +132,8 @@ xbps_remove_installed_pkg(const char *pkgname, bool force)
printf("Package %s is not installed.\n", pkgname); printf("Package %s is not installed.\n", pkgname);
return 0; return 0;
} }
prop_dictionary_get_cstring_nocopy(dict, "version", &version); if (!prop_dictionary_get_cstring_nocopy(dict, "version", &version))
return errno;
reqby = prop_dictionary_get(dict, "requiredby"); reqby = prop_dictionary_get(dict, "requiredby");
if (reqby != NULL && prop_array_count(reqby) > 0) { if (reqby != NULL && prop_array_count(reqby) > 0) {

View File

@ -61,10 +61,17 @@ repoidx_getdict(const char *pkgdir)
goto out; goto out;
} }
prop_dictionary_set(dict, "packages", array); if (!prop_dictionary_set(dict, "packages", array)) {
prop_object_release(dict);
prop_object_release(array);
goto out;
}
prop_object_release(array); prop_object_release(array);
prop_dictionary_set_cstring_nocopy(dict, if (!prop_dictionary_set_cstring_nocopy(dict,
"pkgindex-version", XBPS_PKGINDEX_VERSION); "pkgindex-version", XBPS_PKGINDEX_VERSION)) {
prop_object_release(dict);
goto out;
}
} }
out: out:
free(plist); free(plist);
@ -128,10 +135,18 @@ xbps_repo_addpkg_index(prop_dictionary_t idxdict, const char *file)
break; break;
} }
prop_dictionary_get_cstring_nocopy(newpkgd, "pkgname", if (!prop_dictionary_get_cstring_nocopy(newpkgd, "pkgname",
&pkgname); &pkgname)) {
prop_dictionary_get_cstring_nocopy(newpkgd, "version", prop_object_release(newpkgd);
&version); rv = errno;
break;
}
if (!prop_dictionary_get_cstring_nocopy(newpkgd, "version",
&version)) {
prop_object_release(newpkgd);
rv = errno;
break;
}
/* /*
* Check if this package exists already in the index, but first * Check if this package exists already in the index, but first
* checking the version. If current package version is greater * checking the version. If current package version is greater
@ -140,8 +155,12 @@ xbps_repo_addpkg_index(prop_dictionary_t idxdict, const char *file)
*/ */
curpkgd = xbps_find_pkg_in_dict(idxdict, "packages", pkgname); curpkgd = xbps_find_pkg_in_dict(idxdict, "packages", pkgname);
if (curpkgd) { if (curpkgd) {
prop_dictionary_get_cstring_nocopy(curpkgd, if (!prop_dictionary_get_cstring_nocopy(curpkgd,
"version", &regver); "version", &regver)) {
prop_object_release(newpkgd);
rv = errno;
break;
}
if (xbps_cmpver(version, regver) <= 0) { if (xbps_cmpver(version, regver) <= 0) {
printf("W: skipping %s. %s-%s already " printf("W: skipping %s. %s-%s already "
"registered.\n", filen, pkgname, regver); "registered.\n", filen, pkgname, regver);
@ -167,14 +186,24 @@ xbps_repo_addpkg_index(prop_dictionary_t idxdict, const char *file)
* We have the dictionary now, add the required * We have the dictionary now, add the required
* objects for the index. * objects for the index.
*/ */
prop_dictionary_set_cstring(newpkgd, "filename", filen); if (!prop_dictionary_set_cstring(newpkgd, "filename", filen)) {
prop_object_release(newpkgd);
rv = errno;
break;
}
sha256 = xbps_get_file_hash(file); sha256 = xbps_get_file_hash(file);
if (sha256 == NULL) { if (sha256 == NULL) {
prop_object_release(newpkgd); prop_object_release(newpkgd);
rv = errno; rv = errno;
break; break;
} }
prop_dictionary_set_cstring(newpkgd, "filename-sha256", sha256); if (!prop_dictionary_set_cstring(newpkgd,
"filename-sha256", sha256)) {
prop_object_release(newpkgd);
free(sha256);
rv = errno;
break;
}
free(sha256); free(sha256);
if (stat(file, &st) == -1) { if (stat(file, &st) == -1) {
@ -182,8 +211,12 @@ xbps_repo_addpkg_index(prop_dictionary_t idxdict, const char *file)
rv = errno; rv = errno;
break; break;
} }
prop_dictionary_set_uint64(newpkgd, "filename-size", if (!prop_dictionary_set_uint64(newpkgd, "filename-size",
(uint64_t)st.st_size); (uint64_t)st.st_size)) {
prop_object_release(newpkgd);
rv = errno;
break;
}
/* /*
* Add dictionary into the index and update package count. * Add dictionary into the index and update package count.
*/ */
@ -199,8 +232,13 @@ xbps_repo_addpkg_index(prop_dictionary_t idxdict, const char *file)
rv = EINVAL; rv = EINVAL;
break; break;
} }
prop_dictionary_set_uint64(idxdict, "total-pkgs", if (!prop_dictionary_set_uint64(idxdict, "total-pkgs",
prop_array_count(pkgar)); prop_array_count(pkgar))) {
prop_object_release(newpkgd);
rv = errno;
break;
}
prop_object_release(newpkgd);
printf("Registered %s-%s in package index.\n", printf("Registered %s-%s in package index.\n",
pkgname, version); pkgname, version);
printf("\033[1A\033[K"); printf("\033[1A\033[K");

View File

@ -207,7 +207,12 @@ show_pkg_files_from_metadir(const char *pkgname)
goto out; goto out;
} }
while ((obj = prop_object_iterator_next(iter))) { while ((obj = prop_object_iterator_next(iter))) {
prop_dictionary_get_cstring_nocopy(obj, "file", &file); if (!prop_dictionary_get_cstring_nocopy(obj,
"file", &file)) {
prop_object_iterator_release(iter);
rv = errno;
goto out;
}
printf("%s\n", file); printf("%s\n", file);
} }
prop_object_iterator_release(iter); prop_object_iterator_release(iter);
@ -230,7 +235,12 @@ show_pkg_files_from_metadir(const char *pkgname)
goto out; goto out;
} }
while ((obj = prop_object_iterator_next(iter))) { while ((obj = prop_object_iterator_next(iter))) {
prop_dictionary_get_cstring_nocopy(obj, "file", &file); if (!prop_dictionary_get_cstring_nocopy(obj,
"file", &file)) {
prop_object_iterator_release(iter);
rv = errno;
goto out;
}
printf("%s\n", file); printf("%s\n", file);
} }
prop_object_iterator_release(iter); prop_object_iterator_release(iter);

View File

@ -52,8 +52,16 @@ xbps_configure_all_pkgs(void)
return ENOENT; return ENOENT;
while ((obj = prop_object_iterator_next(iter)) != NULL) { while ((obj = prop_object_iterator_next(iter)) != NULL) {
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname); if (!prop_dictionary_get_cstring_nocopy(obj,
prop_dictionary_get_cstring_nocopy(obj, "version", &version); "pkgname", &pkgname)) {
rv = errno;
break;
}
if (!prop_dictionary_get_cstring_nocopy(obj,
"version", &version)) {
rv = errno;
break;
}
if ((rv = xbps_get_pkg_state_dictionary(obj, &state)) != 0) if ((rv = xbps_get_pkg_state_dictionary(obj, &state)) != 0)
break; break;
if (state != XBPS_PKG_STATE_UNPACKED) if (state != XBPS_PKG_STATE_UNPACKED)
@ -102,7 +110,11 @@ xbps_configure_pkg(const char *pkgname, const char *version, bool check_state)
if (pkgd == NULL) if (pkgd == NULL)
return ENOENT; return ENOENT;
prop_dictionary_get_cstring_nocopy(pkgd, "version", &lver); if (!prop_dictionary_get_cstring_nocopy(pkgd,
"version", &lver)) {
prop_object_release(pkgd);
return errno;
}
prop_object_release(pkgd); prop_object_release(pkgd);
} else { } else {
lver = version; lver = version;

View File

@ -50,7 +50,8 @@ store_dependency(prop_dictionary_t master, prop_dictionary_t depd,
/* /*
* Get some info about dependencies and current repository. * Get some info about dependencies and current repository.
*/ */
prop_dictionary_get_cstring_nocopy(depd, "pkgname", &pkgname); if (!prop_dictionary_get_cstring_nocopy(depd, "pkgname", &pkgname))
return errno;
dict = prop_dictionary_copy(depd); dict = prop_dictionary_copy(depd);
if (dict == NULL) if (dict == NULL)
@ -84,7 +85,10 @@ store_dependency(prop_dictionary_t master, prop_dictionary_t depd,
/* /*
* Add required objects into package dep's dictionary. * Add required objects into package dep's dictionary.
*/ */
prop_dictionary_set_cstring(dict, "repository", repoloc); if (!prop_dictionary_set_cstring(dict, "repository", repoloc)) {
prop_object_release(dict);
return errno;
}
/* /*
* Remove some unneeded objects. * Remove some unneeded objects.
*/ */
@ -121,9 +125,14 @@ add_missing_reqdep(prop_dictionary_t master, const char *pkgname,
return errno; return errno;
missing_rdeps = prop_dictionary_get(master, "missing_deps"); missing_rdeps = prop_dictionary_get(master, "missing_deps");
prop_dictionary_set_cstring(mdepd, "pkgname", pkgname); if (!prop_dictionary_set_cstring(mdepd, "pkgname", pkgname)) {
prop_dictionary_set_cstring(mdepd, "version", version); prop_object_release(mdepd);
return errno;
}
if (!prop_dictionary_set_cstring(mdepd, "version", version)) {
prop_object_release(mdepd);
return errno;
}
if (!xbps_add_obj_to_array(missing_rdeps, mdepd)) { if (!xbps_add_obj_to_array(missing_rdeps, mdepd)) {
prop_object_release(mdepd); prop_object_release(mdepd);
return EINVAL; return EINVAL;
@ -147,7 +156,9 @@ xbps_find_deps_in_pkg(prop_dictionary_t master, prop_dictionary_t pkg)
if (pkg_rdeps == NULL) if (pkg_rdeps == NULL)
return 0; return 0;
prop_dictionary_get_cstring_nocopy(pkg, "pkgname", &pkgname); if (!prop_dictionary_get_cstring_nocopy(pkg, "pkgname", &pkgname))
return errno;
DPRINTF(("Checking rundeps for %s.\n", pkgname)); DPRINTF(("Checking rundeps for %s.\n", pkgname));
/* /*
* Iterate over the repository pool and find out if we have * Iterate over the repository pool and find out if we have
@ -213,6 +224,10 @@ find_repo_deps(prop_dictionary_t master, prop_dictionary_t repo,
*/ */
while ((obj = prop_object_iterator_next(iter)) != NULL) { while ((obj = prop_object_iterator_next(iter)) != NULL) {
reqpkg = prop_string_cstring_nocopy(obj); reqpkg = prop_string_cstring_nocopy(obj);
if (reqpkg == NULL) {
rv = EINVAL;
break;
}
/* /*
* Check if required dep is satisfied and installed. * Check if required dep is satisfied and installed.
*/ */

View File

@ -156,6 +156,11 @@ xbps_prepare_repolist_data(void)
} }
rdata->rd_uri = prop_string_cstring(obj); rdata->rd_uri = prop_string_cstring(obj);
if (rdata->rd_uri == NULL) {
free(plist);
rv = EINVAL;
goto out2;
}
rdata->rd_repod = prop_dictionary_internalize_from_file(plist); rdata->rd_repod = prop_dictionary_internalize_from_file(plist);
if (rdata->rd_repod == NULL) { if (rdata->rd_repod == NULL) {
free(plist); free(plist);
@ -225,7 +230,11 @@ xbps_find_new_packages(void)
* installed packages. * installed packages.
*/ */
while ((obj = prop_object_iterator_next(iter)) != NULL) { while ((obj = prop_object_iterator_next(iter)) != NULL) {
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname); if (!prop_dictionary_get_cstring_nocopy(obj,
"pkgname", &pkgname)) {
rv = errno;
break;
}
rv = xbps_find_new_pkg(pkgname, obj); rv = xbps_find_new_pkg(pkgname, obj);
if (rv == ENOENT) if (rv == ENOENT)
continue; continue;
@ -276,10 +285,16 @@ xbps_find_new_pkg(const char *pkgname, prop_dictionary_t instpkg)
* Check if version in repository is greater than * Check if version in repository is greater than
* the version currently installed. * the version currently installed.
*/ */
prop_dictionary_get_cstring_nocopy(instpkg, if (!prop_dictionary_get_cstring_nocopy(instpkg,
"version", &instver); "version", &instver)) {
prop_dictionary_get_cstring_nocopy(pkgrd, rv = errno;
"version", &repover); break;
}
if (!prop_dictionary_get_cstring_nocopy(pkgrd,
"version", &repover)) {
rv = errno;
break;
}
if (xbps_cmpver(repover, instver) > 0) { if (xbps_cmpver(repover, instver) > 0) {
DPRINTF(("Found %s-%s in repo %s.\n", DPRINTF(("Found %s-%s in repo %s.\n",
pkgname, repover, rdata->rd_uri)); pkgname, repover, rdata->rd_uri));
@ -307,7 +322,10 @@ xbps_find_new_pkg(const char *pkgname, prop_dictionary_t instpkg)
/* /*
* Set repository in pkg dictionary. * Set repository in pkg dictionary.
*/ */
prop_dictionary_set_cstring(pkgrd, "repository", rdata->rd_uri); if (!prop_dictionary_set_cstring(pkgrd, "repository", rdata->rd_uri)) {
rv = errno;
goto out;
}
/* /*
* Construct the dependency chain for this package. * Construct the dependency chain for this package.
@ -332,7 +350,11 @@ xbps_find_new_pkg(const char *pkgname, prop_dictionary_t instpkg)
if ((rv = set_pkg_state(pkgrd, pkgname)) != 0) if ((rv = set_pkg_state(pkgrd, pkgname)) != 0)
goto out; goto out;
prop_dictionary_set_cstring_nocopy(pkgrd, "trans-action", "update"); if (!prop_dictionary_set_cstring_nocopy(pkgrd,
"trans-action", "update")) {
rv = errno;
goto out;
}
if (!prop_array_add(unsorted, pkgrd)) if (!prop_array_add(unsorted, pkgrd))
rv = errno; rv = errno;
@ -405,8 +427,14 @@ xbps_prepare_pkg(const char *pkgname)
/* /*
* Set repository in pkg dictionary. * Set repository in pkg dictionary.
*/ */
prop_dictionary_set_cstring(pkgrd, "repository", rdata->rd_uri); if (!prop_dictionary_set_cstring(pkgrd, "repository", rdata->rd_uri)) {
prop_dictionary_set_cstring(pkg_props, "origin", pkgname); rv = errno;
goto out;
}
if (!prop_dictionary_set_cstring(pkg_props, "origin", pkgname)) {
rv = errno;
goto out;
}
/* /*
* Check if this package needs dependencies. * Check if this package needs dependencies.
@ -458,7 +486,11 @@ xbps_prepare_pkg(const char *pkgname)
if ((rv = set_pkg_state(pkgrd, pkgname)) != 0) if ((rv = set_pkg_state(pkgrd, pkgname)) != 0)
goto out; goto out;
prop_dictionary_set_cstring_nocopy(pkgrd, "trans-action", "install"); if (!prop_dictionary_set_cstring_nocopy(pkgrd,
"trans-action", "install")) {
rv = errno;
goto out;
}
if (!prop_array_add(pkgs_array, pkgrd)) if (!prop_array_add(pkgs_array, pkgrd))
rv = errno; rv = errno;

View File

@ -83,6 +83,9 @@ find_orphan_pkg(prop_object_t obj, void *arg, bool *loop_done)
while ((obj2 = prop_object_iterator_next(iter)) != NULL) { while ((obj2 = prop_object_iterator_next(iter)) != NULL) {
pkgname = xbps_get_pkg_name(prop_string_cstring_nocopy(obj2)); pkgname = xbps_get_pkg_name(prop_string_cstring_nocopy(obj2));
if (pkgname == NULL)
return EINVAL;
SIMPLEQ_FOREACH(orphan, &orphan_list, chain) { SIMPLEQ_FOREACH(orphan, &orphan_list, chain) {
if (strcmp(orphan->pkgname, pkgname) == 0) { if (strcmp(orphan->pkgname, pkgname) == 0) {
ndep++; ndep++;
@ -101,7 +104,11 @@ add_orphan:
if (orphan == NULL) if (orphan == NULL)
return errno; return errno;
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &orphan->pkgname); if (!prop_dictionary_get_cstring_nocopy(obj, "pkgname",
&orphan->pkgname)) {
free(orphan);
return errno;
}
orphan->dict = prop_dictionary_copy(obj); orphan->dict = prop_dictionary_copy(obj);
SIMPLEQ_INSERT_TAIL(&orphan_list, orphan, chain); SIMPLEQ_INSERT_TAIL(&orphan_list, orphan, chain);
@ -151,7 +158,10 @@ xbps_find_orphan_packages(void)
return NULL; return NULL;
} }
while ((orphan = SIMPLEQ_FIRST(&orphan_list)) != NULL) { while ((orphan = SIMPLEQ_FIRST(&orphan_list)) != NULL) {
prop_array_add(array, orphan->dict); if (!prop_array_add(array, orphan->dict)) {
cleanup();
return NULL;
}
SIMPLEQ_REMOVE(&orphan_list, orphan, orphan_pkg, chain); SIMPLEQ_REMOVE(&orphan_list, orphan, orphan_pkg, chain);
prop_object_release(orphan->dict); prop_object_release(orphan->dict);
free(orphan); free(orphan);

View File

@ -372,8 +372,11 @@ xbps_remove_pkg_from_dict(prop_dictionary_t dict, const char *key,
/* Iterate over the array of dictionaries to find its index. */ /* Iterate over the array of dictionaries to find its index. */
while ((obj = prop_object_iterator_next(iter))) { while ((obj = prop_object_iterator_next(iter))) {
prop_dictionary_get_cstring_nocopy(obj, "pkgname", if (!prop_dictionary_get_cstring_nocopy(obj, "pkgname",
&curpkgname); &curpkgname)) {
prop_object_iterator_release(iter);
return errno;
}
if ((curpkgname && (strcmp(curpkgname, pkgname) == 0))) { if ((curpkgname && (strcmp(curpkgname, pkgname) == 0))) {
found = true; found = true;
break; break;

View File

@ -53,7 +53,11 @@ xbps_purge_all_pkgs(void)
return ENOENT; return ENOENT;
while ((obj = prop_object_iterator_next(iter)) != NULL) { while ((obj = prop_object_iterator_next(iter)) != NULL) {
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname); if (!prop_dictionary_get_cstring_nocopy(obj,
"pkgname", &pkgname)) {
rv = errno;
break;
}
if ((rv = xbps_get_pkg_state_dictionary(obj, &state)) != 0) if ((rv = xbps_get_pkg_state_dictionary(obj, &state)) != 0)
break; break;
if (state != XBPS_PKG_STATE_CONFIG_FILES) if (state != XBPS_PKG_STATE_CONFIG_FILES)
@ -139,7 +143,12 @@ xbps_purge_pkg(const char *pkgname, bool check_state)
prop_object_release(dict); prop_object_release(dict);
return EINVAL; return EINVAL;
} }
prop_dictionary_get_cstring_nocopy(obj, "sha256", &sha256); if (!prop_dictionary_get_cstring_nocopy(obj,
"sha256", &sha256)) {
prop_object_iterator_release(iter);
prop_object_release(dict);
return errno;
}
rv = xbps_check_file_hash(path, sha256); rv = xbps_check_file_hash(path, sha256);
if (rv == ENOENT) { if (rv == ENOENT) {
printf("Configuration file %s doesn't exist!\n", file); printf("Configuration file %s doesn't exist!\n", file);

View File

@ -68,10 +68,30 @@ xbps_register_pkg(prop_dictionary_t pkgrd, bool automatic)
rv = ENOENT; rv = ENOENT;
goto out; goto out;
} }
prop_dictionary_set_cstring_nocopy(pkgd, "version", version); if (!prop_dictionary_set_cstring_nocopy(pkgd,
prop_dictionary_set_cstring_nocopy(pkgd, "pkgver", pkgver); "version", version)) {
prop_dictionary_set_cstring_nocopy(pkgd, "short_desc", desc); prop_object_release(pkgd);
prop_dictionary_set_bool(pkgd, "automatic-install", automatic); rv = errno;
goto out;
}
if (!prop_dictionary_set_cstring_nocopy(pkgd,
"pkgver", pkgver)) {
prop_object_release(pkgd);
rv = errno;
goto out;
}
if (!prop_dictionary_set_cstring_nocopy(pkgd,
"short_desc", desc)) {
prop_object_release(pkgd);
rv = errno;
goto out;
}
if (!prop_dictionary_set_bool(pkgd,
"automatic-install", automatic)) {
prop_object_release(pkgd);
rv = errno;
goto out;
}
/* /*
* Add the requiredby objects for dependent packages. * Add the requiredby objects for dependent packages.

View File

@ -101,7 +101,12 @@ files:
prop_object_iterator_release(iter); prop_object_iterator_release(iter);
return EINVAL; return EINVAL;
} }
prop_dictionary_get_cstring_nocopy(obj, "sha256", &sha256); if (!prop_dictionary_get_cstring_nocopy(obj,
"sha256", &sha256)) {
prop_object_iterator_release(iter);
free(path);
return errno;
}
rv = xbps_check_file_hash(path, sha256); rv = xbps_check_file_hash(path, sha256);
if (rv == ENOENT) { if (rv == ENOENT) {
printf("WARNING: '%s' doesn't exist!\n", file); printf("WARNING: '%s' doesn't exist!\n", file);

View File

@ -101,6 +101,11 @@ remove_pkg_from_reqby(prop_object_t obj, void *arg, bool *loop_done)
while ((obj2 = prop_object_iterator_next(iter)) != NULL) { while ((obj2 = prop_object_iterator_next(iter)) != NULL) {
curpkgname = curpkgname =
xbps_get_pkg_name(prop_string_cstring_nocopy(obj2)); xbps_get_pkg_name(prop_string_cstring_nocopy(obj2));
if (curpkgname == NULL) {
prop_object_iterator_release(iter);
return EINVAL;
}
if (strcmp(curpkgname, pkgname) == 0) { if (strcmp(curpkgname, pkgname) == 0) {
free(curpkgname); free(curpkgname);
found = true; found = true;
@ -157,7 +162,8 @@ xbps_requiredby_pkg_add(prop_array_t regar, prop_dictionary_t pkg)
char *rdepname; char *rdepname;
int rv = 0; int rv = 0;
prop_dictionary_get_cstring_nocopy(pkg, "pkgver", &pkgver); if (!prop_dictionary_get_cstring_nocopy(pkg, "pkgver", &pkgver))
return errno;
rdeps = prop_dictionary_get(pkg, "run_depends"); rdeps = prop_dictionary_get(pkg, "run_depends");
if (rdeps == NULL || prop_array_count(rdeps) == 0) if (rdeps == NULL || prop_array_count(rdeps) == 0)
@ -169,7 +175,15 @@ xbps_requiredby_pkg_add(prop_array_t regar, prop_dictionary_t pkg)
while ((obj = prop_object_iterator_next(iter)) != NULL) { while ((obj = prop_object_iterator_next(iter)) != NULL) {
str = prop_string_cstring_nocopy(obj); str = prop_string_cstring_nocopy(obj);
if (str == NULL) {
rv = errno;
goto out;
}
rdepname = xbps_get_pkgdep_name(str); rdepname = xbps_get_pkgdep_name(str);
if (rdepname == NULL) {
rv = EINVAL;
goto out;
}
iter2 = prop_array_iterator(regar); iter2 = prop_array_iterator(regar);
if (iter2 == NULL) { if (iter2 == NULL) {
free(rdepname); free(rdepname);
@ -182,8 +196,13 @@ xbps_requiredby_pkg_add(prop_array_t regar, prop_dictionary_t pkg)
* current run dependency. * current run dependency.
*/ */
while ((obj2 = prop_object_iterator_next(iter2)) != NULL) { while ((obj2 = prop_object_iterator_next(iter2)) != NULL) {
prop_dictionary_get_cstring_nocopy(obj2, "pkgname", if (!prop_dictionary_get_cstring_nocopy(obj2,
&reqname); "pkgname", &reqname)) {
free(rdepname);
prop_object_iterator_release(iter2);
rv = errno;
goto out;
}
if (strcmp(rdepname, reqname) == 0) { if (strcmp(rdepname, reqname) == 0) {
rv = add_pkg_into_reqby(obj2, pkgver); rv = add_pkg_into_reqby(obj2, pkgver);
if (rv == EEXIST) if (rv == EEXIST)

View File

@ -80,9 +80,7 @@ xbps_sort_pkg_deps(prop_dictionary_t chaindeps)
prop_dictionary_set(chaindeps, "packages", sorted); prop_dictionary_set(chaindeps, "packages", sorted);
return 0; return 0;
} }
ndeps = prop_array_count(unsorted); ndeps = prop_array_count(unsorted);
unsorted = prop_dictionary_get(chaindeps, "unsorted_deps");
iter = prop_array_iterator(unsorted); iter = prop_array_iterator(unsorted);
if (iter == NULL) { if (iter == NULL) {
@ -94,7 +92,11 @@ again:
* Order all deps by looking at its run_depends array. * Order all deps by looking at its run_depends array.
*/ */
while ((obj = prop_object_iterator_next(iter)) != NULL) { while ((obj = prop_object_iterator_next(iter)) != NULL) {
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname); if (!prop_dictionary_get_cstring_nocopy(obj,
"pkgname", &pkgname)) {
rv = errno;
goto out;
}
if (find_sorteddep_by_name(pkgname) != NULL) if (find_sorteddep_by_name(pkgname) != NULL)
continue; continue;
@ -126,7 +128,17 @@ again:
*/ */
while ((obj2 = prop_object_iterator_next(iter2)) != NULL) { while ((obj2 = prop_object_iterator_next(iter2)) != NULL) {
str = prop_string_cstring_nocopy(obj2); str = prop_string_cstring_nocopy(obj2);
if (str == NULL) {
free(sdep);
rv = EINVAL;
goto out;
}
curpkgnamedep = xbps_get_pkgdep_name(str); curpkgnamedep = xbps_get_pkgdep_name(str);
if (curpkgnamedep == NULL) {
free(sdep);
rv = EINVAL;
goto out;
}
/* /*
* If dependency is already installed or queued, * If dependency is already installed or queued,
* pass to the next one. * pass to the next one.
@ -163,7 +175,11 @@ again:
* Add all sorted dependencies into the sorted deps array. * Add all sorted dependencies into the sorted deps array.
*/ */
while ((sdep = SIMPLEQ_FIRST(&sdep_list)) != NULL) { while ((sdep = SIMPLEQ_FIRST(&sdep_list)) != NULL) {
prop_array_add(sorted, sdep->dict); if (!prop_array_add(sorted, sdep->dict)) {
free(sdep);
rv = errno;
goto out;
}
SIMPLEQ_REMOVE(&sdep_list, sdep, sorted_dependency, chain); SIMPLEQ_REMOVE(&sdep_list, sdep, sorted_dependency, chain);
prop_object_release(sdep->dict); prop_object_release(sdep->dict);
free(sdep); free(sdep);

View File

@ -72,8 +72,7 @@ get_state(prop_dictionary_t dict)
assert(dict != NULL); assert(dict != NULL);
prop_dictionary_get_cstring_nocopy(dict, "state", &state_str); if (!prop_dictionary_get_cstring_nocopy(dict, "state", &state_str))
if (state_str == NULL)
return 0; return 0;
if (strcmp(state_str, "unpacked") == 0) if (strcmp(state_str, "unpacked") == 0)
@ -177,7 +176,12 @@ xbps_set_pkg_state_installed(const char *pkgname, pkg_state_t state)
rv = errno; rv = errno;
goto out; goto out;
} }
prop_dictionary_set_cstring_nocopy(pkgd, "pkgname", pkgname); if (!prop_dictionary_set_cstring_nocopy(pkgd, "pkgname",
pkgname)) {
prop_object_release(array);
rv = errno;
goto out;
}
if ((rv = set_new_state(pkgd, state)) != 0) { if ((rv = set_new_state(pkgd, state)) != 0) {
prop_object_release(array); prop_object_release(array);
goto out; goto out;
@ -198,8 +202,12 @@ xbps_set_pkg_state_installed(const char *pkgname, pkg_state_t state)
if (pkgd == NULL) { if (pkgd == NULL) {
newpkg = true; newpkg = true;
pkgd = prop_dictionary_create(); pkgd = prop_dictionary_create();
prop_dictionary_set_cstring_nocopy(pkgd, "pkgname", if (!prop_dictionary_set_cstring_nocopy(pkgd,
pkgname); "pkgname", pkgname)) {
prop_object_release(pkgd);
rv = errno;
goto out;
}
} }
array = prop_dictionary_get(dict, "packages"); array = prop_dictionary_get(dict, "packages");
if (array == NULL) { if (array == NULL) {

View File

@ -50,7 +50,9 @@ xbps_unpack_binary_pkg(prop_dictionary_t pkg, bool essential)
/* /*
* Append filename to the full path for binary pkg. * Append filename to the full path for binary pkg.
*/ */
prop_dictionary_get_cstring_nocopy(pkg, "pkgname", &pkgname); if (!prop_dictionary_get_cstring_nocopy(pkg, "pkgname", &pkgname))
return errno;
filename = prop_dictionary_get(pkg, "filename"); filename = prop_dictionary_get(pkg, "filename");
arch = prop_dictionary_get(pkg, "architecture"); arch = prop_dictionary_get(pkg, "architecture");
repoloc = prop_dictionary_get(pkg, "repository"); repoloc = prop_dictionary_get(pkg, "repository");
@ -172,8 +174,12 @@ install_config_file(prop_dictionary_t d, struct archive_entry *entry,
iter2 = xbps_get_array_iter_from_dict(forigd, "conf_files"); iter2 = xbps_get_array_iter_from_dict(forigd, "conf_files");
if (iter2 != NULL) { if (iter2 != NULL) {
while ((obj2 = prop_object_iterator_next(iter2))) { while ((obj2 = prop_object_iterator_next(iter2))) {
prop_dictionary_get_cstring_nocopy(obj2, if (!prop_dictionary_get_cstring_nocopy(obj2,
"file", &cffile); "file", &cffile)) {
prop_object_iterator_release(iter2);
rv = errno;
goto out;
}
buf = xbps_xasprintf(".%s", cffile); buf = xbps_xasprintf(".%s", cffile);
if (buf == NULL) { if (buf == NULL) {
prop_object_iterator_release(iter2); prop_object_iterator_release(iter2);
@ -204,7 +210,11 @@ install_config_file(prop_dictionary_t d, struct archive_entry *entry,
* Compare original, installed and new hash for current file. * Compare original, installed and new hash for current file.
*/ */
while ((obj = prop_object_iterator_next(iter))) { while ((obj = prop_object_iterator_next(iter))) {
prop_dictionary_get_cstring_nocopy(obj, "file", &cffile); if (!prop_dictionary_get_cstring_nocopy(obj,
"file", &cffile)) {
prop_object_iterator_release(iter);
return errno;
}
buf = xbps_xasprintf(".%s", cffile); buf = xbps_xasprintf(".%s", cffile);
if (buf == NULL) { if (buf == NULL) {
prop_object_iterator_release(iter); prop_object_iterator_release(iter);
@ -217,8 +227,8 @@ install_config_file(prop_dictionary_t d, struct archive_entry *entry,
} }
sha256_cur = xbps_get_file_hash(buf); sha256_cur = xbps_get_file_hash(buf);
free(buf); free(buf);
prop_dictionary_get_cstring_nocopy(obj, "sha256", &sha256_new); if (!prop_dictionary_get_cstring_nocopy(obj,
if (sha256_new == NULL) { "sha256", &sha256_new)) {
rv = EINVAL; rv = EINVAL;
break; break;
} }
@ -341,8 +351,10 @@ unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg,
if (chdir(rootdir) == -1) if (chdir(rootdir) == -1)
return errno; return errno;
prop_dictionary_get_cstring_nocopy(pkg, "pkgname", &pkgname); if (!prop_dictionary_get_cstring_nocopy(pkg, "pkgname", &pkgname))
prop_dictionary_get_cstring_nocopy(pkg, "version", &version); return errno;
if (!prop_dictionary_get_cstring_nocopy(pkg, "version", &version))
return errno;
while (archive_read_next_header(ar, &entry) == ARCHIVE_OK) { while (archive_read_next_header(ar, &entry) == ARCHIVE_OK) {
entry_str = archive_entry_pathname(entry); entry_str = archive_entry_pathname(entry);
@ -536,8 +548,16 @@ again:
while ((obj = prop_object_iterator_next(iter))) { while ((obj = prop_object_iterator_next(iter))) {
found = false; found = false;
oldstr = prop_dictionary_get(obj, "file"); oldstr = prop_dictionary_get(obj, "file");
if (oldstr == NULL) {
rv = errno;
goto out;
}
while ((obj2 = prop_object_iterator_next(iter2))) { while ((obj2 = prop_object_iterator_next(iter2))) {
newstr = prop_dictionary_get(obj2, "file"); newstr = prop_dictionary_get(obj2, "file");
if (newstr == NULL) {
rv = errno;
goto out;
}
if (prop_string_equals(oldstr, newstr)) { if (prop_string_equals(oldstr, newstr)) {
found = true; found = true;
break; break;