Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!decvax!ucbvax!cbatt!cbosgd!soma!masscomp
From: masscomp@soma.UUCP
Newsgroups: mod.computers.masscomp
Subject: nntp and news 2.11
Message-ID: <2687@soma.bcm.tmc.edu>
Date: Thu, 11-Dec-86 16:31:47 EST
Article-I.D.: soma.2687
Posted: Thu Dec 11 16:31:47 1986
Date-Received: Sun, 14-Dec-86 12:30:17 EST
Organization: Masscomp Users' Society
Lines: 94
Approved: masscomp@soma.uucp


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) {