Skip to content

Commit 333c399

Browse files
committed
lib: make xbps_pkgdb_get_pkg set ENOENT when package is not found
this matches the expected behaviour and the other `xbps_*_get_pkg` functions. References #458.
1 parent ba36b19 commit 333c399

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/pkgdb.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,15 @@ xbps_pkgdb_foreach_cb_multi(struct xbps_handle *xhp,
415415
xbps_dictionary_t
416416
xbps_pkgdb_get_pkg(struct xbps_handle *xhp, const char *pkg)
417417
{
418+
xbps_dictionary_t pkgd;
419+
418420
if (xbps_pkgdb_init(xhp) != 0)
419421
return NULL;
420422

421-
return xbps_find_pkg_in_dict(xhp->pkgdb, pkg);
423+
pkgd = xbps_find_pkg_in_dict(xhp->pkgdb, pkg);
424+
if (!pkgd)
425+
errno = ENOENT;
426+
return pkgd;
422427
}
423428

424429
xbps_dictionary_t

0 commit comments

Comments
 (0)