mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
ctdb-daemon: Clean up error handling and debug
Add some missing error handling and error messages. Remove a use of CTDB_NO_MEMORY(), which then renders the caller's use of ctdb_errstr() pointless, so remove that too. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
This commit is contained in:
parent
3429ba764c
commit
01cc3f0784
@ -158,10 +158,14 @@ int ctdb_set_address(struct ctdb_context *ctdb, const char *address)
|
||||
bool ok;
|
||||
|
||||
ctdb->address = talloc(ctdb, ctdb_sock_addr);
|
||||
CTDB_NO_MEMORY(ctdb, ctdb->address);
|
||||
if (ctdb->address == NULL) {
|
||||
DBG_ERR("Memory allocation error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ok = ctdb_parse_node_address(address, ctdb->address);
|
||||
if (!ok) {
|
||||
DBG_ERR("Failed to parse node address\n");
|
||||
TALLOC_FREE(ctdb->address);
|
||||
return -1;
|
||||
}
|
||||
@ -169,6 +173,12 @@ int ctdb_set_address(struct ctdb_context *ctdb, const char *address)
|
||||
ctdb->name = talloc_asprintf(ctdb, "%s:%u",
|
||||
ctdb_addr_to_str(ctdb->address),
|
||||
ctdb_addr_to_port(ctdb->address));
|
||||
if (ctdb->name == NULL) {
|
||||
DBG_ERR("Memory allocation error\n");
|
||||
TALLOC_FREE(ctdb->address);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -297,8 +297,7 @@ int main(int argc, const char *argv[])
|
||||
if (ctdb_config.node_address) {
|
||||
ret = ctdb_set_address(ctdb, ctdb_config.node_address);
|
||||
if (ret == -1) {
|
||||
D_ERR("ctdb_set_address failed - %s\n",
|
||||
ctdb_errstr(ctdb));
|
||||
D_ERR("Failed to set node address\n");
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user