🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: mod.computers.masscomp
1 messages
1 total messages Started by masscomp Thu, 11 Dec 1986 21:31
nntp and news 2.11
#77
Author: masscomp
Date: Thu, 11 Dec 1986 21:31
94 lines
2931 bytes
I think this is really a bug in Masscomp's implementation of flock, but
since news 2.11 uses flock, nntp should possibly respect those locks...

In any case, here is some code that makes is work on MASSCOMP's.

Use patch to install in the server directory off the nntp root directory.

Index: active.c
*** /tmp/,RCSt1004793	Thu Dec 11 15:17:07 1986
--- /tmp/,RCSt2004793	Thu Dec 11 15:17:07 1986
***************
*** 1,5
  #ifndef lint
! static char	*sccsid = "@(#)active.c	1.4	(Berkeley) 5/17/86";
  #endif
  
  #include "common.h"

--- 1,5 -----
  #ifndef lint
! static char	*sccsid = "@(#)active.c	1.5	(Berkeley) 12/10/86";
  #endif
  
  #include "common.h"
***************
*** 53,58
  #endif
  		return (0);
  	}
  
  	while (i < MAX_GROUPS && fgets(line, sizeof(line), act_fp) != NULL) {
  		if ((group_array[i] = malloc(strlen(line)+1)) == NULL) {

--- 53,66 -----
  #endif
  		return (0);
  	}
+ 
+ /* these changes necessary for news 2.11  -- sob@soma.bcm.tmc.edu */
+ 	if (flock(fileno(act_fp),LOCK_SH|LOCK_NB)< 0  && errno == EWOULDBLOCK)
+ 		{
+ 			(void) fclose(act_fp);
+ 			return (0);
+ 		}
+ /* end changes */
  
  	while (i < MAX_GROUPS && fgets(line, sizeof(line), act_fp) != NULL) {
  		if ((group_array[i] = malloc(strlen(line)+1)) == NULL) {

Index: list.c
*** /tmp/,RCSt1004782	Thu Dec 11 15:16:45 1986
--- /tmp/,RCSt2004782	Thu Dec 11 15:16:45 1986
***************
*** 1,5
  #ifndef lint
! static char	*sccsid = "@(#)list.c	1.4	(Berkeley) 5/17/86";
  #endif
  
  #include "common.h"

--- 1,5 -----
  #ifndef lint
! static char	*sccsid = "@(#)list.c	1.5	(Berkeley) 12/10/86";
  #endif
  
  #include "common.h"
***************
*** 30,35
  		return;
  	}
  
  	printf("%d Newsgroups in form \"group high low y/n\".\r\n", OK_GROUPS);
  
  	while (fgets(line, sizeof(line), active_fp) != NULL) {

--- 30,46 -----
  		return;
  	}
  
+ /* These changes necessary for news 2.11. -- sob@soma.bcm.tmc.edu */
+ /* These locks are supposed to be advisory, but sometimes they are not. */
+ 	if (flock(fileno(active_fp),LOCK_SH|LOCK_NB)< 0 
+ 					 && errno == EWOULDBLOCK)
+ 		{
+ 			(void) fclose(active_fp);
+ 			printf("%d Active file is locked.\r\n",ERR_FAULT);
+ 			(void) fflush(stdout);
+ 			return;
+ 		}
+ /* end changes */
  	printf("%d Newsgroups in form \"group high low y/n\".\r\n", OK_GROUPS);
  
  	while (fgets(line, sizeof(line), active_fp) != NULL) {
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads