On Thu, 28 Dec 2023 at 17:24, Sam Varshavchik <mr...@courier-mta.com> wrote:
> Stephen Smoogen writes: > > > I am trying to figure out the logic of this section: > > > > > > ``` > > > > static char * lastUname = NULL; // So lastUname is NULL > > static uid_t lastUid; > > > > if (!thisUname) { > > lastUname = rfree(lastUname); // lastUname should still be NULL > and > > we are freeing NULL and setting itself back to NULL. > > return -1; > > > > ``` > > > > > > > > I expect this is where I am not understanding something basic in C from > too > > many years in non-pointer land. I looked at the change of these lines > and > > they date back to this commit. > > This is a fairly common kind of simple caching to avoid expensive > username/userid and groupname/groupid lookups by caching the last one. > This Yeah I completely forgot that static allows for caching so I was misreading this as 'always set to NULL at the beginning.' > > https://github.com/rpm-software-management/rpm/issues/2826 > > > And thanks for opening a bug. I will watch to see what happens. -- Stephen Smoogen, Red Hat Automotive Let us be kind to one another, for most of us are fighting a hard battle. -- Ian MacClaren
-- _______________________________________________ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue