From 714ba5f50551a42df324714358dc379b351d4a53 Mon Sep 17 00:00:00 2001 From: Michal Zidek Date: Tue, 16 Apr 2013 13:14:51 +0200 Subject: Inform about function duplication. 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. --- src/responder/nss/nsssrv_mmap_cache.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/responder/nss') diff --git a/src/responder/nss/nsssrv_mmap_cache.c b/src/responder/nss/nsssrv_mmap_cache.c index ec05f761c..49878fcfb 100644 --- a/src/responder/nss/nsssrv_mmap_cache.c +++ b/src/responder/nss/nsssrv_mmap_cache.c @@ -768,6 +768,9 @@ done: * initialization ***************************************************************************/ +/* Copy of sss_mc_set_recycled is present in the src/tools/tools_mc_util.c. + * If you modify this function, you should modify the duplicated function + * too. */ static errno_t sss_mc_set_recycled(int fd) { uint32_t w = SSS_MC_HEADER_RECYCLED; -- cgit