From: Sebastian Harl Date: Sat, 10 Jan 2015 12:33:13 +0000 (+0100) Subject: store: Let store_metric() accept non-NULL but empty metric-store. X-Git-Tag: sysdb-0.7.0~81 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=6791557ad47026ded3fdfef06087e1feab315bfd store: Let store_metric() accept non-NULL but empty metric-store. --- 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);