#1767 unify sss_mc_set_recycled
Closed: Fixed None Opened 6 years ago by jhrozek.

For some reason, we have two implementations of sss_mc_set_recycled in sssd. They are exactly the same. Code duplication is bad, we should unify them.


Fields changed

milestone: NEEDS_TRIAGE => SSSD 1.10 beta
rhbz: => 0
type: defect => task

Not critical for beta, can be done in 1.10 proper

review: => 0

Fields changed

owner: somebody => mzidek

sss_mc_set_recycled is a static function, that should not be used outside nsssrv_mmap_cache.c. The sss_cache tool is an exception, because in the case when sssd is not running, sss_cache must invalidate the memory cache file. That is why sss_mc_set_recycled was copied to the tools_mc_util.c (as helper function for sss_memcache_invalidate function). It was duplicated to allow this function to remain static (and invisible to any .h files), so that it is not used anywhere else. Wrong usage of this function might cause race conditions and corrupt the cache.

I'll add comments about the duplication to the code.

Works for me. As long as the "fix" would make it hard to forget to change the other function, I'm fine.

Fields changed

patch: 0 => 1

resolution: => fixed
status: new => closed

Metadata Update from @jhrozek:
- Issue assigned to mzidek
- Issue set to the milestone: SSSD 1.10 beta

2 years ago

Login to comment on this ticket.

Metadata