🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Steven M. Schultz Sun, 17 Dec 1989 20:50
lpd vs. files longer than 32kb
#260
Author: Steven M. Schultz
Date: Sun, 17 Dec 1989 20:50
144 lines
3590 bytes
Subject: lpd vs. files longer than 32kb
Index:	usr.lib/lpr/recvjob.c 2.10BSD

Description:
	There is a batch of long vs. int bugs in recvjob.c which
	will cause problems printing files longer than 32kb. An earlier
	bug report dealt with sending jobs from a 2.10.1BSD system outbound,
	this fix handles inbound print jobs.

	In addition, the freespace check for sufficient room on the
	spooling disc is incorrect because the amount of free space
	on a disc (fs_tfree) is a "daddr_t" rather than an "int".

Repeat-By:
	Send a file longer than 32kb to 'lpd' on a 2.10.1BSD system or,
	have more than 64k blocks free on the spooling filesystem.

Fix:
	Apply the following patch and recompile/install lpd.

*** recvjob.c.old	Sun Feb 22 06:33:06 1987
--- recvjob.c	Sun Dec 17 13:56:08 1989
***************
*** 21,31 ****
  
  char    tfname[40];		/* tmp copy of cf before linking */
  char    dfname[40];		/* data files */
! int	minfree;		/* keep at least minfree blocks available */
  char	*ddev;			/* disk device (for checking free space) */
  int	dfd;			/* file system device descriptor */
  
  char	*find_dev();
  
  recvjob()
  {
--- 21,32 ----
  
  char    tfname[40];		/* tmp copy of cf before linking */
  char    dfname[40];		/* data files */
! long	minfree;		/* keep at least minfree blocks available */
  char	*ddev;			/* disk device (for checking free space) */
  int	dfd;			/* file system device descriptor */
  
  char	*find_dev();
+ long	read_number(), atol();
  
  recvjob()
  {
***************
*** 110,116 ****
   */
  readjob()
  {
! 	register int size, nfiles;
  	register char *cp;
  
  	ack();
--- 111,118 ----
   */
  readjob()
  {
! 	register nfiles;
! 	long	size;
  	register char *cp;
  
  	ack();
***************
*** 187,197 ****
   */
  readfile(file, size)
  	char *file;
! 	int size;
  {
  	register char *cp;
  	char buf[BUFSIZ];
! 	register int i, j, amt;
  	int fd, err;
  
  	fd = open(file, O_WRONLY|O_CREAT, FILMOD);
--- 189,200 ----
   */
  readfile(file, size)
  	char *file;
! 	long size;
  {
  	register char *cp;
  	char buf[BUFSIZ];
! 	register int j, amt;
! 	long i;
  	int fd, err;
  
  	fd = open(file, O_WRONLY|O_CREAT, FILMOD);
***************
*** 246,256 ****
   * 1 == OK, 0 == Not OK.
   */
  chksize(size)
! 	int size;
  {
  	struct stat stb;
  	register char *ddev;
! 	int spacefree;
  	struct fs fs;
  
  	if (dfd < 0 || lseek(dfd, (long)(SBLOCK * DEV_BSIZE), 0) < 0)
--- 249,259 ----
   * 1 == OK, 0 == Not OK.
   */
  chksize(size)
! 	long size;
  {
  	struct stat stb;
  	register char *ddev;
! 	long spacefree;
  	struct fs fs;
  
  	if (dfd < 0 || lseek(dfd, (long)(SBLOCK * DEV_BSIZE), 0) < 0)
***************
*** 270,275 ****
--- 273,279 ----
  	return(1);
  }
  
+ long
  read_number(fn)
  	char *fn;
  {
***************
*** 283,289 ****
  		return (0);
  	}
  	fclose(fp);
! 	return (atoi(lin));
  }
  
  /*
--- 287,293 ----
  		return (0);
  	}
  	fclose(fp);
! 	return (atol(lin));
  }
  
  /*
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