[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patch] version 1.9.2 -- alarm not being reset on error
While looking through the source code of leafnode-1.9.2, I happened to
notice inside of `nntputil.c' that the alarm is not being reset to 0
if the connect fails before the alarm goes off. This could cause a
spurious SIGALRM interrupt during the processing of news in a
subsquently connected news server. Although this is not a likely
occurrence, it still is worthwhile to reset the alarm to 0 even
if a connection fails.
Here's my patch which, I believe, corrects this situation:
*** nntputil.c.orig Mon Mar 15 01:07:56 1999
--- nntputil.c Mon Mar 15 01:17:14 1999
***************
*** 187,193 ****
struct servent *sp;
struct servent sp_def;
struct sockaddr_in s_in;
! int sock, reply;
register int i;
memset((void *)&s_in, 0, sizeof(s_in));
--- 187,193 ----
struct servent *sp;
struct servent sp_def;
struct sockaddr_in s_in;
! int sock, reply, result;
register int i;
memset((void *)&s_in, 0, sizeof(s_in));
***************
*** 223,231 ****
(void) signal(SIGALRM, timer);
(void) alarm((unsigned) upstream->timeout );
! if (connect(sock, (struct sockaddr *)&s_in, sizeof(s_in)) < 0)
! break;
(void) alarm((unsigned)0);
nntpout = fdopen(sock, "w");
if (nntpout == NULL)
--- 223,233 ----
(void) signal(SIGALRM, timer);
(void) alarm((unsigned) upstream->timeout );
! result = connect(sock, (struct sockaddr *)&s_in, sizeof(s_in));
(void) alarm((unsigned)0);
+ if (result < 0) {
+ break;
+ }
nntpout = fdopen(sock, "w");
if (nntpout == NULL)
--
Lloyd Zusman
ljz@xxxxxxxxxx
--
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list