On Thu, 28 Dec 2023 at 17:24, Sam Varshavchik mrsam@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.'
And thanks for opening a bug. I will watch to see what happens.