Explicitly set errno to ENOENT when a pkg hasn't been found in array/dictionaries.
This commit is contained in:
@ -90,7 +90,11 @@ get_pkg_in_array(xbps_array_t array, const char *str, bool virtual)
|
|||||||
}
|
}
|
||||||
xbps_object_iterator_release(iter);
|
xbps_object_iterator_release(iter);
|
||||||
|
|
||||||
return found ? obj : NULL;
|
if (!found) {
|
||||||
|
errno = ENOENT;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
xbps_dictionary_t HIDDEN
|
xbps_dictionary_t HIDDEN
|
||||||
@ -140,8 +144,10 @@ match_pkg_by_pkgver(xbps_dictionary_t repod, const char *p)
|
|||||||
d = xbps_dictionary_get(repod, pkgname);
|
d = xbps_dictionary_get(repod, pkgname);
|
||||||
if (d) {
|
if (d) {
|
||||||
xbps_dictionary_get_cstring_nocopy(d, "pkgver", &pkgver);
|
xbps_dictionary_get_cstring_nocopy(d, "pkgver", &pkgver);
|
||||||
if (strcmp(pkgver, p))
|
if (strcmp(pkgver, p)) {
|
||||||
d = NULL;
|
d = NULL;
|
||||||
|
errno = ENOENT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(pkgname);
|
free(pkgname);
|
||||||
@ -168,8 +174,10 @@ match_pkg_by_pattern(xbps_dictionary_t repod, const char *p)
|
|||||||
if (d) {
|
if (d) {
|
||||||
xbps_dictionary_get_cstring_nocopy(d, "pkgver", &pkgver);
|
xbps_dictionary_get_cstring_nocopy(d, "pkgver", &pkgver);
|
||||||
assert(pkgver);
|
assert(pkgver);
|
||||||
if (!xbps_pkgpattern_match(pkgver, p))
|
if (!xbps_pkgpattern_match(pkgver, p)) {
|
||||||
d = NULL;
|
d = NULL;
|
||||||
|
errno = ENOENT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(pkgname);
|
free(pkgname);
|
||||||
|
@ -224,7 +224,7 @@ find_repo_deps(struct xbps_handle *xhp,
|
|||||||
if (errno && errno != ENOENT) {
|
if (errno && errno != ENOENT) {
|
||||||
/* error */
|
/* error */
|
||||||
rv = errno;
|
rv = errno;
|
||||||
xbps_dbg_printf(xhp, "failed to find installed pkg for `%s': %s\n", reqpkg, strerror(errno));
|
xbps_dbg_printf(xhp, "failed to find installed pkg for `%s': %s\n", reqpkg, strerror(rv));
|
||||||
free(pkgname);
|
free(pkgname);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user