fetchmail-friends
[Top] [All Lists]

Re: [fetchmail]set_timeout() problem...

2001-11-08 09:20:56
Sunil Shetye <shetye(_at_)bombay(_dot_)retortsoft(_dot_)com>:
I do not know what issues are involved in EMX and BEOS. However, I
have attached a patch which should work for all POSIX compliant
platforms.

If this patch is acceptable, another similar patch for
interruptible_idle() will be posted.

Note that alarm() is POSIX compliant while setitimer() isn't.

Sunil Shetye.

diff -Naur fetchmail-5.9.3.orig/driver.c fetchmail-5.9.3/driver.c
--- fetchmail-5.9.3.orig/driver.c     Fri Sep 28 20:30:58 2001
+++ fetchmail-5.9.3/driver.c  Wed Oct  3 10:09:00 2001
@@ -71,16 +71,11 @@
 void set_timeout(int timeleft)
 /* reset the nonresponse-timeout */
 {
-#if !defined(__EMX__) && !defined(__BEOS__) 
-    struct itimerval ntimeout;
-
+#if defined SIGALRM
     if (timeleft == 0)
      timeoutcount = 0;
 
-    ntimeout.it_interval.tv_sec = ntimeout.it_interval.tv_usec = 0;
-    ntimeout.it_value.tv_sec  = timeleft;
-    ntimeout.it_value.tv_usec = 0;
-    setitimer(ITIMER_REAL, &ntimeout, (struct itimerval *)NULL);
+    alarm(timeleft);
 #endif
 }
 

No, this is bad.  See the comments under SLEEP_WITH_ALARM in driver.c.
-- 
                <a href="http://www.tuxedo.org/~esr/";>Eric S. Raymond</a>

Never could an increase of comfort or security be a sufficient good to be
bought at the price of liberty.
        -- Hillaire Belloc


<Prev in Thread] Current Thread [Next in Thread>
  • Re: [fetchmail]set_timeout() problem..., Eric S. Raymond <=