inews/rnews posting problem: a fix/cure

Keith Muller muller at sdcc7.UUCP
Thu Apr 24 03:47:28 AEST 1986


I had the same problem quite a while ago. However in my case student accounts
were set up with both cpu and file limits to help prevent runaway homeworks
etc from loading down the machine. I couldn't remove the limits, so I added
the following into inews. (applies only to 4.[23] BSD).
	Keith Muller
	University of California

*** OLD/inews.c	Wed Mar 19 17:14:29 1986
--- inews.c	Fri Mar 21 00:39:17 1986
***************
*** 21,26 ****
--- 21,29 ----
  #endif /* SCCSID */
  
  #include "iparams.h"
+ #ifdef BSD4_2
+ #include <sys/resource.h>
+ #endif  /* BSD4_2 */
  #include <errno.h>
  
  /* local defines for inews */
***************
*** 96,101 ****
--- 99,120 ----
  	register int	i;
  	FILE	*mfd;		/* mail file file-descriptor		*/
  	char	cbuf[BUFLEN];	/* command buffer			*/
+ #ifdef BSD4_2
+ 	struct rlimit reslimit; /* resource limits inherited from parent*/
+ 
+ 	/* 
+ 	 * if a user has limit set in his shell, inews when invoked from
+ 	 * postnews might fail (such if the file size limit is small)
+ 	 */
+ 	if (getrlimit(RLIMIT_CPU, &reslimit) == 0){
+ 		reslimit.rlim_cur = reslimit.rlim_max;
+ 		(void)setrlimit(RLIMIT_CPU, &reslimit);
+ 	}
+ 	if (getrlimit(RLIMIT_FSIZE, &reslimit) == 0){
+ 		reslimit.rlim_cur = reslimit.rlim_max;
+ 		(void)setrlimit(RLIMIT_FSIZE, &reslimit);
+ 	}
+ #endif /* BSD4_2 */
  
  	/* uuxqt doesn't close all it's files */
  	for (i = 3; !close(i); i++)



More information about the Net.bugs mailing list