On ABIs with defined 'char' was unsigned type, clang fails to build
support_process_state.c with:
support_process_state.c:70:21: error: result of comparison of constant -1 with expression of type 'char' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
70 | if (cur_state == -1)
| ~~~~~~~~~ ^ ~~
1 error generated.
Reviewed-by: Sam James <sam@gentoo.org>
for (;;)
{
- char cur_state = -1;
+ char cur_state = CHAR_MAX;
while (xgetline (&line, &linesiz, fstatus) > 0)
if (strncmp (line, "State:", strlen ("State:")) == 0)
{
break;
}
/* Fallback to nanosleep for invalid state. */
- if (cur_state == -1)
+ if (cur_state == CHAR_MAX)
break;
for (size_t i = 0; i < array_length (process_states); ++i)