diff options
author | Volker Lendecke <vl@samba.org> | 2009-09-23 15:47:05 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-09-23 18:50:33 +0200 |
commit | cd749ef8bd271b1de0212e25c67f87283ba7582b (patch) | |
tree | 9fea4e466c5b68dcc174ce0fdd604965081aa193 | |
parent | aece84f22de9aceb150a04b68dea18abcff968b2 (diff) | |
download | samba-cd749ef8bd271b1de0212e25c67f87283ba7582b.tar.gz samba-cd749ef8bd271b1de0212e25c67f87283ba7582b.tar.bz2 samba-cd749ef8bd271b1de0212e25c67f87283ba7582b.zip |
s3:gencache: Make gencache_del() return success for expired entries
This fixes nasty error messages from "net cache flush"
-rw-r--r-- | source3/lib/gencache.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c index 2f603dbb2d..d3631b96ee 100644 --- a/source3/lib/gencache.c +++ b/source3/lib/gencache.c @@ -208,9 +208,9 @@ done: bool gencache_del(const char *keystr) { - bool exists; + bool exists, was_expired; bool ret = false; - char *value; + DATA_BLOB value; if (keystr == NULL) { return false; @@ -226,9 +226,18 @@ bool gencache_del(const char *keystr) * element. */ - exists = gencache_get(keystr, &value, NULL); + exists = gencache_get_data_blob(keystr, &value, NULL, &was_expired); + + if (!exists && was_expired) { + /* + * gencache_get_data_blob has implicitly deleted this + * entry, so we have to return success here. + */ + return true; + } + if (exists) { - SAFE_FREE(value); + data_blob_free(&value); ret = gencache_set(keystr, "", 0); } return ret; |