summaryrefslogtreecommitdiff
path: root/src/tools
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/tools
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/tools')
-rw-r--r--src/tools/tools_mc_util.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/tools/tools_mc_util.c b/src/tools/tools_mc_util.c
index d623c48c..b563fac3 100644
--- a/src/tools/tools_mc_util.c
+++ b/src/tools/tools_mc_util.c
@@ -28,6 +28,9 @@
#include "util/mmap_cache.h"
#include "sss_client/sss_cli.h"
+/* This is a copy of sss_mc_set_recycled present in
+ * src/responder/nss/nsssrv_mmap_cache.c. If you modify this function,
+ * you should modify the original function too. */
static errno_t sss_mc_set_recycled(int fd)
{
uint32_t w = SSS_MC_HEADER_RECYCLED;