chiark / gitweb /
alarm(2) returns unsigned and can never fail
authorian <ian>
Sat, 8 Apr 2006 12:06:42 +0000 (12:06 +0000)
committerian <ian>
Sat, 8 Apr 2006 12:06:42 +0000 (12:06 +0000)
client.c
debian/changelog
overlord.c

index 6664fbc4a8080b27d29b3cd1b3931584c4105da4..520928f9d42e5c87056cc5912b1a13167a84ae81 100644 (file)
--- a/client.c
+++ b/client.c
@@ -1161,7 +1161,7 @@ static void prepare_asynchsignals(void) {
   if (sigaction(SIGALRM,&sig,0)) syscallerror("set up sigalrm handler");
 
   if (!timeout) return;
   if (sigaction(SIGALRM,&sig,0)) syscallerror("set up sigalrm handler");
 
   if (!timeout) return;
-  if (alarm(timeout)<0) syscallerror("set up timeout alarm");
+  alarm(timeout);
 }
 
 
 }
 
 
index 595c7e9a0a2f76322068300b4824ccf103590130..cbd0e16226ea877f6870effd90fc0a15d01d7dfb 100644 (file)
@@ -5,6 +5,7 @@ userv (1.0.5) unstable; urgency=low
     Thanks to report from Nelson Beebe.
   * Correct an erroneous assert() argument so that it would actually
     detect failure of the assertion.
     Thanks to report from Nelson Beebe.
   * Correct an erroneous assert() argument so that it would actually
     detect failure of the assertion.
+  * alarm(2) returns unsigned and can never fail.
 
   Packaging changes:
   * Reran flex (flex Debian 2.5.31-31).
 
   Packaging changes:
   * Reran flex (flex Debian 2.5.31-31).
index 2715b79b0a03e736a9fd1d750f9d35347c61f6ad..3ba4114008d041db558a90196c4ecc2369edec57 100644 (file)
@@ -118,8 +118,7 @@ static void sighandler_chld(int x) {
               (long)checkpid,status);
       }
       checkpid= -1;
               (long)checkpid,status);
       }
       checkpid= -1;
-      ar= alarm(USERVD_MYSELF_CHECK);
-      if (ar<0) { syslog(LOG_CRIT,"set alarm for next check: %m"); exit(5); }
+      alarm(USERVD_MYSELF_CHECK);
     } else {
       if (WIFSIGNALED(status)) {
        syslog(LOG_ERR,"call pid %ld %s due to signal %s",
     } else {
       if (WIFSIGNALED(status)) {
        syslog(LOG_ERR,"call pid %ld %s due to signal %s",
@@ -209,8 +208,7 @@ static void NONRETURNING docheck(int needwanted) {
     syslog(LOG_ERR,"unable to connect to uservd daemon: %m"); exit(1);
   }
 
     syslog(LOG_ERR,"unable to connect to uservd daemon: %m"); exit(1);
   }
 
-  r= alarm(USERVD_MYSELF_TIMEOUT);
-  if (r<0) { syslog(LOG_ERR,"set alarm for read: %m"); exit(1); }
+  alarm(USERVD_MYSELF_TIMEOUT);
   remain= sizeof(opening_mbuf); p= (unsigned char*)&opening_mbuf;
   while (remain) {
     r= read(sfd,p,remain);
   remain= sizeof(opening_mbuf); p= (unsigned char*)&opening_mbuf;
   while (remain) {
     r= read(sfd,p,remain);
@@ -354,8 +352,7 @@ int main(int argc, char *const *argv) {
          break;
        } else if (errno==EAGAIN) {
          syslog(LOG_ERR,"fork for check - will wait and retry: %m");
          break;
        } else if (errno==EAGAIN) {
          syslog(LOG_ERR,"fork for check - will wait and retry: %m");
-         r= alarm(USERVD_CHECKFORK_RETRY);
-         if (r<0) { syslog(LOG_CRIT,"set alarm for retry check: %m"); exit(5); }
+         alarm(USERVD_CHECKFORK_RETRY);
          break;
        } else if (errno!=EINTR) {
          syslog(LOG_CRIT,"fork for check: %m"); exit(5);
          break;
        } else if (errno!=EINTR) {
          syslog(LOG_CRIT,"fork for check: %m"); exit(5);