Preventing cache_object_fd leak while being called in object_is_cached. On the other hand, I do this think this part of code is subject to refactoring. The usage of cache_object_fd is really subtle ;)
FYI. Signed-off-by: Xinwei Hu <[email protected] > diff --git a/sheep/object_cache.c b/sheep/object_cache.c index 27a64a9..f75b7a1 100644 --- a/sheep/object_cache.c +++ b/sheep/object_cache.c @@ -457,8 +457,10 @@ int object_is_cached(uint64_t oid) cache->oid = oid; if (object_cache_lookup(cache, idx) < 0) return 0; - else + else { + close(cache_object_fd); return 1; /* found it */ + } } int object_cache_init(const char *p) -- sheepdog mailing list [email protected] http://lists.wpkg.org/mailman/listinfo/sheepdog
