diff options
author | Michael Cardell Widerkrantz <mc@hack.org> | 2010-07-28 16:16:08 +0200 |
---|---|---|
committer | Michael Cardell Widerkrantz <mc@hack.org> | 2010-07-28 16:16:08 +0200 |
commit | 0cab6a71bbac93229f8311d726f165dfe35d5af4 (patch) | |
tree | ffa003dffe735f888d1ba853aeecea680ec8f2ea | |
parent | 25248c2c5d3a3709e6216fe3a4b50d3166fdd93f (diff) | |
download | mcwm-0cab6a71bbac93229f8311d726f165dfe35d5af4.zip |
Change order of comparison with errno EINTR from select(). Seems
nicer.
Break out of loop if we get EINTR instead of continue. Same effect
since the for loop ends when sigcode != 0, but this makes it more
explicit.
-rw-r--r-- | mcwm.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -2217,16 +2217,17 @@ void events(void) found = select(fd + 1, &in, NULL, NULL, NULL); if (-1 == found) { - if (EINTR != errno) + if (EINTR == errno) { - fprintf(stderr, "mcwm: select failed."); - cleanup(0); - exit(1); + /* We received a signal. Break out of loop. */ + break; } else { - /* We received a signal. Goto start of loop. */ - continue; + /* Something was seriously wrong with select(). */ + fprintf(stderr, "mcwm: select failed."); + cleanup(0); + exit(1); } } else |