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

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