Commit 09d8fdf9 authored by Michael Pyne's avatar Michael Pyne

Properly check if mdraid array is active.

Don't compare a bool with an int.  This causes this part of the
comparison to always evaluate to 'true'.

In this case the corrected check actually appears to be necessary
(inactive raid arrays won't show the "raid%d" type of output that is
meant to be copied into ->Level).  Also noted by Coverity, CID 256387.
parent 7c551f82
......@@ -508,7 +508,7 @@ md1 : active raid1 sda2[0] sdb2[1]
MyArray->ArrayActive = true;
else if (strncmp(current_word, "inactive", sizeof("inactive")-1)==0)
MyArray->ArrayActive = false;
else if (MyArray->ArrayActive >=0 && MyArray->level == NULL && current_word[0] != '(' && current_word[0] != ':' /*readonly*/) {
else if (MyArray->ArrayActive && MyArray->level == NULL && current_word[0] != '(' && current_word[0] != ':' /*readonly*/) {
MyArray->level = strndup(current_word, current_word_length);
in_devs = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment