summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e78e4d1)
raw | patch | inline | side by side (parent: e78e4d1)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 14 Jul 2009 12:00:49 +0000 (12:00 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 14 Jul 2009 12:00:49 +0000 (12:00 +0000) |
src/rrd_daemon.c | patch | blob | history |
diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c
index 17ec97edd37eaae65c5bf322d4878f66663e5d51..8b1fc9e79059b05aed3c4581decfd33cfad17405 100644 (file)
--- a/src/rrd_daemon.c
+++ b/src/rrd_daemon.c
if (ci == NULL) /* {{{ */
{
struct stat statbuf;
+ cache_item_t *tmp;
/* don't hold the lock while we setup; stat(2) might block */
pthread_mutex_unlock(&cache_lock);
pthread_cond_init(&ci->flushed, NULL);
pthread_mutex_lock(&cache_lock);
- g_tree_replace (cache_tree, (void *) ci->file, (void *) ci);
+
+ /* another UPDATE might have added this entry in the meantime */
+ tmp = g_tree_lookup (cache_tree, file);
+ if (tmp == NULL)
+ g_tree_replace (cache_tree, (void *) ci->file, (void *) ci);
+ else
+ {
+ free_cache_item (ci);
+ ci = tmp;
+ }
} /* }}} */
assert (ci != NULL);