diff options
author | Amitay Isaacs <amitay@gmail.com> | 2017-03-07 14:13:10 +1100 |
---|---|---|
committer | Martin Schwenke <martins@samba.org> | 2017-03-29 11:07:18 +0200 |
commit | 6e9879f6e2f8974730517fad22875db06f0738de (patch) | |
tree | 507c2ee43a61638961c41823101e8b6369013ed8 /ctdb/tools | |
parent | 12cd7ab60a1d2cf891c061652fbcad6f8fed56d1 (diff) | |
download | samba-6e9879f6e2f8974730517fad22875db06f0738de.tar.gz |
ctdb-tools: Avoid deferencing argv[0] if argc == 0
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12723
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Mar 29 11:07:18 CEST 2017 on sn-devel-144
Diffstat (limited to 'ctdb/tools')
-rw-r--r-- | ctdb/tools/ctdb_event.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ctdb/tools/ctdb_event.c b/ctdb/tools/ctdb_event.c index 62b4b9121a7..8e2dca70e67 100644 --- a/ctdb/tools/ctdb_event.c +++ b/ctdb/tools/ctdb_event.c @@ -223,23 +223,26 @@ static int command_status(TALLOC_CTX *mem_ctx, struct tool_context *tctx, talloc_free(req); if (! status) { fprintf(stderr, "Failed to get event %s status, ret=%d\n", - argv[0], ret); + ctdb_event_to_string(event), ret); return ret; } if (result != 0) { fprintf(stderr, "Failed to get event %s status, result=%d\n", - argv[0], result); + ctdb_event_to_string(event), result); return result; } if (script_list == NULL) { if (state == CTDB_EVENT_LAST_RUN) { - printf("Event %s has never run\n", argv[0]); + printf("Event %s has never run\n", + ctdb_event_to_string(event)); } else if (state == CTDB_EVENT_LAST_PASS) { - printf("Event %s has never passed\n", argv[0]); + printf("Event %s has never passed\n", + ctdb_event_to_string(event)); } else if (state == CTDB_EVENT_LAST_FAIL) { - printf("Event %s has never failed\n", argv[0]); + printf("Event %s has never failed\n", + ctdb_event_to_string(event)); } } else { for (i=0; i<script_list->num_scripts; i++) { |