rpool: if pkg wasn't found set errno to ENOENT.

This is to return a proper error to the callers (i.e xbps-query(1)).
This commit is contained in:
Juan RP
2015-10-19 17:05:55 +02:00
parent faeff38ca2
commit 240d87af92
2 changed files with 12 additions and 2 deletions

View File

@ -296,14 +296,21 @@ repo_find_pkg(struct xbps_handle *xhp,
* Find revdeps for pkg.
*/
rv = xbps_rpool_foreach(xhp, find_pkg_revdeps_cb, &rpf);
break;
}
if (rv != 0) {
errno = rv;
return NULL;
}
if (type == REVDEPS_PKG)
return rpf.revdeps;
if (type == REVDEPS_PKG) {
if (rpf.revdeps == NULL)
errno = ENOENT;
return rpf.revdeps;
} else {
if (rpf.pkgd == NULL)
errno = ENOENT;
}
return rpf.pkgd;
}