summaryrefslogtreecommitdiff
path: root/src/responder/nss/nsssrv_mmap_cache.c
diff options
context:
space:
mode:
authorMichal Zidek <mzidek@redhat.com>2013-04-16 13:14:51 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-04-17 11:39:57 +0200
commit714ba5f50551a42df324714358dc379b351d4a53 (patch)
tree242a59380ec9bfc783098f2f8d4829489b35a5e5 /src/responder/nss/nsssrv_mmap_cache.c
parent8e195a545d41647e591c1d06082133cbd25dc0a4 (diff)
downloadsssd-714ba5f50551a42df324714358dc379b351d4a53.tar.gz
sssd-714ba5f50551a42df324714358dc379b351d4a53.tar.bz2
sssd-714ba5f50551a42df324714358dc379b351d4a53.zip
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.
Diffstat (limited to 'src/responder/nss/nsssrv_mmap_cache.c')
-rw-r--r--src/responder/nss/nsssrv_mmap_cache.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/responder/nss/nsssrv_mmap_cache.c b/src/responder/nss/nsssrv_mmap_cache.c
index ec05f761..49878fcf 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;