forked from rpm-software-management/rpm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make user/group lookup caching thread-safe
This seems like a huge overkill when in 4.19.1 there's exactly one rpmfiStat() call that unnecessarily invokes an rpmug lookup in a threaded scenario, but then rpmfiStat() and rpmfilesStat() are public APIs that people expect to be safe for use within the originating thread. Collect all the caching data into a struct and allocate on per-thread basis, this seems like the path of least trouble in this case and git diff --stat agrees. It's worth noting that this also simplifies the caching, we no longer keep separate name to id and id to name, totaling caches totaling four. We simply cache one id/name for for user and another for group data. Also, reset ids to 0 rather than -1, this is far more obviously a safe value as we have special cases to handle id 0. rpmugUname() and rpmugGname() are have no users in the current codebase, so this was developed wrt commit c576d96 where they still are used, to avoid nasty surprises later on if somebody finds a new case for these. Fixes: rpm-software-management#2826
- Loading branch information
Showing
1 changed file
with
61 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters