[Sheepdog] [PATCH] farm: fix lookup_trunk_entry
Liu Yuan
namei.unix at gmail.com
Fri Mar 2 11:01:43 CET 2012
From: Liu Yuan <tailai.ly at taobao.com>
It should return NULL when 1. not found and 2. create = 0.
Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
sheep/farm/trunk.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/sheep/farm/trunk.c b/sheep/farm/trunk.c
index fabae8a..b9f0b3e 100644
--- a/sheep/farm/trunk.c
+++ b/sheep/farm/trunk.c
@@ -92,7 +92,8 @@ not_found:
entry = xzalloc(sizeof(*entry));
entry->raw.oid = oid;
get_entry(entry, head);
- }
+ } else
+ entry = NULL;
out:
pthread_mutex_unlock(&hashtable_lock[h]);
return entry;
--
1.7.8.2
More information about the sheepdog
mailing list