1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

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
This commit is contained in:
Amitay Isaacs 2017-03-07 14:13:10 +11:00 committed by Martin Schwenke
parent 12cd7ab60a
commit 6e9879f6e2

View File

@ -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++) {