From a3188674ee2386b7b2ca66116f9bcce71b32a9dd Mon Sep 17 00:00:00 2001 From: ian Date: Sat, 8 Apr 2006 12:06:42 +0000 Subject: [PATCH] alarm(2) returns unsigned and can never fail --- client.c | 2 +- debian/changelog | 1 + overlord.c | 9 +++------ 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/client.c b/client.c index 6664fbc..520928f 100644 --- 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 (alarm(timeout)<0) syscallerror("set up timeout alarm"); + alarm(timeout); } diff --git a/debian/changelog b/debian/changelog index 595c7e9..cbd0e16 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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. + * alarm(2) returns unsigned and can never fail. Packaging changes: * Reran flex (flex Debian 2.5.31-31). diff --git a/overlord.c b/overlord.c index 2715b79..3ba4114 100644 --- a/overlord.c +++ b/overlord.c @@ -118,8 +118,7 @@ static void sighandler_chld(int x) { (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", @@ -209,8 +208,7 @@ static void NONRETURNING docheck(int needwanted) { 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); @@ -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"); - 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); -- 2.30.2