This happened to be correct only by coincidence. Quoting Linus:
Assignments inside tests should probably be relegated entirely
to loop constructs, where doing them outside the test changes
semantics.
- if ((r = read(signal_pipe[0], &s, sizeof(s)) == sizeof(s)) > 0) {
+ r = read(signal_pipe[0], &s, sizeof(s));
+ if (r == sizeof(s)) {
PARA_DEBUG_LOG("next signal: %d\n", s);
return s;
}
PARA_DEBUG_LOG("next signal: %d\n", s);
return s;
}