Skip to content

Commit

Permalink
Fix: sbd-pacemaker: bail out of status earlier
Browse files Browse the repository at this point in the history
Prevents possible subsequent null-pointer access and avoids
unnecessary search for node.
  • Loading branch information
wenningerk committed Mar 26, 2019
1 parent a716a8d commit 79b778d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/sbd-pacemaker.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ compute_status(pe_working_set_t * data_set)
static int updates = 0;
static int ever_had_quorum = FALSE;

node_t *node = pe_find_node(data_set->nodes, local_uname);
node_t *node = NULL;

updates++;

Expand All @@ -286,11 +286,15 @@ compute_status(pe_working_set_t * data_set)
return;
}

node = pe_find_node(data_set->nodes, local_uname);

if (node == NULL) {
if ((node == NULL) || (node->details == NULL)) {
set_servant_health(pcmk_health_unknown, LOG_WARNING, "Node state: %s is UNKNOWN", local_uname);
notify_parent();
return;
}

} else if (node->details->online == FALSE) {
if (node->details->online == FALSE) {
set_servant_health(pcmk_health_unknown, LOG_WARNING, "Node state: OFFLINE");

} else if (node->details->unclean) {
Expand Down

0 comments on commit 79b778d

Please sign in to comment.