summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cardell Widerkrantz <mc@hack.org>2010-07-28 16:16:08 +0200
committerMichael Cardell Widerkrantz <mc@hack.org>2010-07-28 16:16:08 +0200
commit0cab6a71bbac93229f8311d726f165dfe35d5af4 (patch)
treeffa003dffe735f888d1ba853aeecea680ec8f2ea
parent25248c2c5d3a3709e6216fe3a4b50d3166fdd93f (diff)
downloadmcwm-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.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/mcwm.c b/mcwm.c
index 0dff3e1..60f0fb1 100644
--- a/mcwm.c
+++ b/mcwm.c
@@ -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