libpriv/util: add precondition to catch potential trap
Basically, it doesn't make sense for the caller to only want the pkglist, but not the refsack because the former has a more limited lifetime than the latter. Check for that to make sure nobody falls in this trap like I did. Closes: #1134 Approved by: cgwalters
This commit is contained in:
parent
25767893a4
commit
718596eace
@ -890,6 +890,10 @@ rpmostree_get_pkglist_for_root (int dfd,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
/* the DnfPackage objects don't have a ref on their DnfSack; make sure callers don't fall
|
||||
* in that trap */
|
||||
g_return_val_if_fail (out_pkglist == NULL || out_refsack != NULL, FALSE);
|
||||
|
||||
g_autoptr(RpmOstreeRefSack) refsack =
|
||||
rpmostree_get_refsack_for_root (dfd, path, cancellable, error);
|
||||
if (!refsack)
|
||||
|
Loading…
Reference in New Issue
Block a user