From 6791557ad47026ded3fdfef06087e1feab315bfd Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Sat, 10 Jan 2015 13:33:13 +0100 Subject: [PATCH] store: Let store_metric() accept non-NULL but empty metric-store. --- src/core/store.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/store.c b/src/core/store.c index 25691dc..98b3a96 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -681,8 +681,13 @@ sdb_store_metric(const char *hostname, const char *name, if ((! hostname) || (! name)) return -1; - if (store && ((! store->type) || (! store->id))) - return -1; + + if (store) { + if ((store->type != NULL) != (store->id != NULL)) + return -1; + else if (! store->type) + store = NULL; + } pthread_rwlock_wrlock(&host_lock); host = lookup_host(hostname, /* canonicalize = */ 1); -- 2.30.2