From acb75880b50674727da204e77ccfd3a5d07f1d96 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 7 Mar 1998 22:31:52 +0000 Subject: Reorganization. svn path=/trunk/; revision=1694 --- fetchmail.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'fetchmail.c') diff --git a/fetchmail.c b/fetchmail.c index 0f187c68..feeb392d 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -561,17 +561,11 @@ int main (int argc, char **argv) */ { #ifndef __EMX__ -#ifndef SLEEP_WITH_ALARM /* not normally on */ - struct timeval timeout; - - timeout.tv_sec = poll_interval; - timeout.tv_usec = 0; - lastsig = 0; - select(0,0,0,0, &timeout); -#else +#ifdef SLEEP_WITH_ALARM /* not normally on */ /* - * This code is flaky under Red Hat Linux 5.0, and possibly - * elsewhere. John Stracke writes: + * This code stops working under glibc-2, apparently due + * to the change in signal(2) semantics. John Stracke + * writes: * * The problem seems to be that, after hitting the interval * timer while talking to the server, the process no longer @@ -585,14 +579,7 @@ int main (int argc, char **argv) * to repoll--but, when the dummy server didn't respond, it * never timed out, and SIGALRM wouldn't make it. * - * So the workaround I used is to make it sleep by using - * select() instead of setitimer()/pause(). select() is - * perfectly happy being called with a timeout and - * no file descriptors; it just sleeps until it hits the - * timeout. The only concern I had was that it might - * implement its timeout with SIGALRM--there are some - * Unices where this is done, because select() is a library - * function--but apparently not. + * (continued below...) */ struct itimerval ntimeout; @@ -604,6 +591,23 @@ int main (int argc, char **argv) signal(SIGALRM, donothing); pause(); signal(SIGALRM, SIG_IGN); +#else + /* + * So the workaround I used is to make it sleep by using + * select() instead of setitimer()/pause(). select() is + * perfectly happy being called with a timeout and + * no file descriptors; it just sleeps until it hits the + * timeout. The only concern I had was that it might + * implement its timeout with SIGALRM--there are some + * Unices where this is done, because select() is a library + * function--but apparently not. + */ + struct timeval timeout; + + timeout.tv_sec = poll_interval; + timeout.tv_usec = 0; + lastsig = 0; + select(0,0,0,0, &timeout); #endif #else /* EMX */ signal(SIGALRM, donothing); -- cgit v1.2.3