nntpcache-1.0 (sigsegv on startup, rfc931 with Sunos)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the network connection to nntp sites is temporarily down when
nntpcached (version 1.0) is started, it will exit with a SIGSEGV.  Is
this intentional?  Is it possible and/or desirable to introduce a more
graceful behavior for this situation?

I've also done some exploring in the rfc931 code in acc.c, which as I
noted earlier does not work on Sunos.  The following simple change
fixes it.  (Sunos requires separate read/write files for the socket --
dunno why.)


cd /usr/local/src/nntpcache-1.0/
diff -c /usr/local/src/nntpcache-1.0/acc.c.orig /usr/local/src/nntpcache-1.0/acc.c
*** /usr/local/src/nntpcache-1.0/acc.c.orig	Tue Oct 15 13:00:57 1996
--- /usr/local/src/nntpcache-1.0/acc.c	Tue Oct 22 12:45:23 1996
***************
*** 28,33 ****
--- 28,37 ----
  	static char user[128];
  	char buf[512];
  	FILE *fh = NULL;	/* stop gcc complaining */
+ 				/* ron@auda.mlfarm.com, 22 Oct 1996 */
+ 				/* For Sunos we need separate */
+ 				/* read/write FILEs.  */
+ 	FILE *fr = NULL;
  	RETSIGTYPE (*al)(int) = NULL;
  	long al_s;
  
***************
*** 48,58 ****
  	}
  	if (connect (sock, (struct sockaddr *) &remote_query_sin, sizeof (remote_query_sin)) == -1)
  		goto err;
! 	fh = fdopen (sock, "r+");
  	fprintf (fh, "%u,%u\r\n", ntohs (remote_sin->sin_port), ntohs (our_sin->sin_port));
  	fflush (fh);
! 	if (fgets (buf, sizeof buf, fh)
! 	    && !ferror (fh)
  	    && sscanf (buf, "%u , %u : USERID :%*[^:]:%127s", &remote_port, &our_port, user) == 3
  	    && ntohs (remote_sin->sin_port) == remote_port
  	    && ntohs (our_sin->sin_port) == our_port)
--- 52,65 ----
  	}
  	if (connect (sock, (struct sockaddr *) &remote_query_sin, sizeof (remote_query_sin)) == -1)
  		goto err;
! 				/* ron@auda.mlfarm.com, 22 Oct 1996 */
! 				/* Sunos needs separate read/write FILEs */
! 	fh = fdopen (sock, "w");
! 	fr = fdopen (sock, "r");
  	fprintf (fh, "%u,%u\r\n", ntohs (remote_sin->sin_port), ntohs (our_sin->sin_port));
  	fflush (fh);
! 	if (fgets (buf, sizeof buf, fr)
! 	    && !ferror (fr)
  	    && sscanf (buf, "%u , %u : USERID :%*[^:]:%127s", &remote_port, &our_port, user) == 3
  	    && ntohs (remote_sin->sin_port) == remote_port
  	    && ntohs (our_sin->sin_port) == our_port)

-- 

   Ronald Florence		Maple Lawn Farm, Stonington, CT
   ron@mlfarm.com		http://www.connix.com/~mlfarm


[Index of Archives]     [Yosemite]     [Yosemite Campsites]     [Bugtraq]     [Linux]     [Trn]

Powered by Linux