libctdb_test_read_nodemap(ctdb);
- if (parse_nodestring(NULL, nodestring, CTDB_CURRENT_NODE, dd_ok,
+ if (parse_nodestring(NULL, NULL, nodestring, CTDB_CURRENT_NODE, dd_ok,
&nodes, &pnn_mode)) {
print_nodes(nodes, pnn_mode);
}
* explicitly specified.
*/
static bool parse_nodestring(struct ctdb_context *ctdb,
+ TALLOC_CTX *mem_ctx,
const char * nodestring,
uint32_t current_pnn,
bool dd_ok,
uint32_t **nodes,
uint32_t *pnn_mode)
{
- TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
+ TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
int n;
uint32_t i;
struct ctdb_node_map *nodemap;
}
if (nodestring != NULL) {
- *nodes = talloc_array(tmp_ctx, uint32_t, 0);
+ *nodes = talloc_array(mem_ctx, uint32_t, 0);
if (*nodes == NULL) {
goto failed;
}
NODE_FLAGS_DELETED)) && !dd_ok) {
continue;
}
- *nodes = talloc_realloc(tmp_ctx, *nodes,
+ *nodes = talloc_realloc(mem_ctx, *nodes,
uint32_t, n+1);
if (*nodes == NULL) {
goto failed;
exit(10);
}
- *nodes = talloc_realloc(ctdb, *nodes,
+ *nodes = talloc_realloc(mem_ctx, *nodes,
uint32_t, n+1);
if (*nodes == NULL) {
goto failed;
}
} else {
/* default - no nodes specified */
- *nodes = talloc_array(tmp_ctx, uint32_t, 1);
+ *nodes = talloc_array(mem_ctx, uint32_t, 1);
if (*nodes == NULL) {
goto failed;
}
usage();
}
- if (!parse_nodestring(ctdb, argc == 1 ? argv[0] : NULL,
+ if (!parse_nodestring(ctdb, tmp_ctx, argc == 1 ? argv[0] : NULL,
options.pnn, true, &nodes, &pnn_mode)) {
return -1;
}
}
/* setup the node number(s) to contact */
- if (!parse_nodestring(ctdb, nodestring, CTDB_CURRENT_NODE, false,
+ if (!parse_nodestring(ctdb, ctdb, nodestring, CTDB_CURRENT_NODE, false,
&options.nodes, &options.pnn)) {
usage();
}