From 9987fe7209c3bd44ea0015d98d0f92b65ec70700 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Wed, 23 Aug 2017 12:09:22 +1000 Subject: ctdb-client: Optionally return database id from ctdb_ctrl_createdb() BUG: https://bugzilla.samba.org/show_bug.cgi?id=12978 Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke --- ctdb/client/ctdb_client.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'ctdb/client') diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c index 74874bab2b2..05710c964fa 100644 --- a/ctdb/client/ctdb_client.c +++ b/ctdb/client/ctdb_client.c @@ -1912,7 +1912,7 @@ int ctdb_ctrl_getdbseqnum(struct ctdb_context *ctdb, struct timeval timeout, */ int ctdb_ctrl_createdb(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, TALLOC_CTX *mem_ctx, - const char *name, uint8_t db_flags) + const char *name, uint8_t db_flags, uint32_t *db_id) { int ret; int32_t res; @@ -1937,6 +1937,15 @@ int ctdb_ctrl_createdb(struct ctdb_context *ctdb, struct timeval timeout, return -1; } + if (data.dsize != sizeof(uint32_t)) { + TALLOC_FREE(data.dptr); + return -1; + } + if (db_id != NULL) { + *db_id = *(uint32_t *)data.dptr; + } + talloc_free(data.dptr); + return 0; } -- cgit v1.2.1