X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fcore%2Fstore.c;h=df8c02fb152a87135c4f44464476d8d8096d5361;hb=e2f0b2814ab337b9f975b16162f73dbbc7fdf717;hp=dace58f899f78ac27d681f22927ed088a7850170;hpb=7ab700ccb35f94c10ee58a92474fa2141151b415;p=sysdb.git diff --git a/src/core/store.c b/src/core/store.c index dace58f..df8c02f 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -259,8 +259,8 @@ store_obj(int parent_type, const char *parent_name, parent = store_lookup(parent_type, parent_name); if (! parent) { sdb_log(SDB_LOG_ERR, "store: Failed to store %s '%s' - " - "parent %s '%s' not found", TYPE_TO_NAME(type), name, - TYPE_TO_NAME(parent_type), parent_name); + "parent %s '%s' not found", SDB_STORE_TYPE_TO_NAME(type), + name, SDB_STORE_TYPE_TO_NAME(parent_type), parent_name); free(parent_cname); free(cname); return -1; @@ -287,7 +287,8 @@ store_obj(int parent_type, const char *parent_name, if (old->last_update > last_update) { sdb_log(SDB_LOG_DEBUG, "store: Cannot update %s '%s' - " "value too old (%"PRIscTIME" < %"PRIscTIME")", - TYPE_TO_NAME(type), name, last_update, old->last_update); + SDB_STORE_TYPE_TO_NAME(type), name, + last_update, old->last_update); /* don't report an error; the object may be updated by multiple * backends */ status = 1; @@ -321,7 +322,7 @@ store_obj(int parent_type, const char *parent_name, if (! new) { char errbuf[1024]; sdb_log(SDB_LOG_ERR, "store: Failed to create %s '%s': %s", - TYPE_TO_NAME(type), name, + SDB_STORE_TYPE_TO_NAME(type), name, sdb_strerror(errno, errbuf, sizeof(errbuf))); free(parent_cname); free(cname); @@ -365,10 +366,10 @@ store_obj_tojson(sdb_llist_t *list, int type, sdb_strbuf_t *buf) if (! iter) { char errbuf[1024]; sdb_log(SDB_LOG_ERR, "store: Failed to retrieve %ss: %s\n", - TYPE_TO_NAME(type), + SDB_STORE_TYPE_TO_NAME(type), sdb_strerror(errno, errbuf, sizeof(errbuf))); sdb_strbuf_append(buf, "{\"error\": \"failed to retrieve %ss: %s\"}", - TYPE_TO_NAME(type), errbuf); + SDB_STORE_TYPE_TO_NAME(type), errbuf); } /* has_next returns false if the iterator is NULL */ @@ -481,6 +482,7 @@ sdb_store_attribute(const char *hostname, if (status >= 0) { assert(updated_attr); + sdb_data_free_datum(&SDB_ATTR(updated_attr)->value); if (sdb_data_copy(&SDB_ATTR(updated_attr)->value, value)) { sdb_object_deref(SDB_OBJ(updated_attr)); status = -1;