🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.bugs.2bsd
Article #310

core dump and bad total length of j

#310
From: MAILER-DAEMON
Date: Fri, 23 May 1986 08:48
68 lines
2965 bytes
Subject: core dump and bad total length of jobs from uuq -l
Index:	/usr/src/usr.bin/uucp/uuq.c 2.9+bsd

Description:
	As above.  
Repeat-By:
	queue up a bunch of jobs.  run uuq -l.  Notice that 
	uuq -l gives you the wrong total length and then dumps core.
Fix:
	Replace a couple of printf("%d", long-value)'s with "... %ld...":
*** /tmp/,RCSt1010028	Fri May 23 04:45:05 1986
--- uuq.c	Fri May 23 04:35:56 1986
***************
*** 130,136
  			/* The 80 * njobs is because of the uucp handshaking */
  			minutes = (float)(sp->s_bytes + 80 * sp->s_njobs)/baudrate;
  			hours = minutes/60;
! 			printf(", %d bytes, ", sp->s_bytes);
  			if (minutes > 60){
  				printf("%d hour%s, ",hours,
  					hours > 1 ? "s": "");

--- 130,136 -----
  			/* The 80 * njobs is because of the uucp handshaking */
  			minutes = (float)(sp->s_bytes + 80 * sp->s_njobs)/baudrate;
  			hours = minutes/60;
! 			printf(", %ld bytes, ", sp->s_bytes);
  			if (minutes > 60){
  				printf("%d hour%s, ",hours,
  					hours > 1 ? "s": "");
***************
*** 142,149
  		if (hflag)
  			continue;
  		/* sort them babies! */
! 		sortjob = (struct job **)calloc(sp->s_njobs, sizeof (struct job
!  *));
  		for (i=0, jp=sp->s_jobp; i < sp->s_njobs; i++, jp=jp->j_jobp)
  			sortjob[i] = jp;
  		qsort(sortjob, sp->s_njobs, sizeof (struct job *), jcompare);

--- 142,148 -----
  		if (hflag)
  			continue;
  		/* sort them babies! */
! 		sortjob = (struct job **)calloc(sp->s_njobs, sizeof (struct job *));
  		for (i=0, jp=sp->s_jobp; i < sp->s_njobs; i++, jp=jp->j_jobp)
  			sortjob[i] = jp;
  		qsort(sortjob, sp->s_njobs, sizeof (struct job *), jcompare);
***************
*** 150,156
  		for (i = 0; i < sp->s_njobs; i++) {
  			jp = sortjob[i];
  			if (lflag) {
! 				printf("%s %2d %-*s%7d%5.1f %-12.12s %c %.*s\n",
  	jp->j_jobno, jp->j_files, Maxulen, jp->j_user, jp->j_bytes, jp->j_bytes/baudrate,
  	ctime(&jp->j_date) + 4, jp->j_flags, sizeof (jp->j_fname), jp->j_fname
  				);

--- 149,155 -----
  		for (i = 0; i < sp->s_njobs; i++) {
  			jp = sortjob[i];
  			if (lflag) {
! 				printf("%s %2d %-*s%7ld%5.1f %-12.12s %c %.*s\n",
  	jp->j_jobno, jp->j_files, Maxulen, jp->j_user, jp->j_bytes, jp->j_bytes/baudrate,
  	ctime(&jp->j_date) + 4, jp->j_flags, sizeof (jp->j_fname), jp->j_fname
  				);
Technical Details
Message-ID: <61800001@gabriel>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!ima!inmet!gabriel!MAILER-DAEMON

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: Notesfiles $Revision: 1.7.0.10 $; site gabriel
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!ima!inmet!gabriel!MAILER-DAEMON
From: MAILER-DAEMON@gabriel.UUCP
Newsgroups: net.bugs.2bsd
Subject: core dump and bad total length of j
Message-ID: <61800001@gabriel>
Date: Fri, 23-May-86 04:48:00 EDT
Article-I.D.: gabriel.61800001
Posted: Fri May 23 04:48:00 1986
Date-Received: Sun, 25-May-86 18:33:56 EDT
Lines: 68
Nf-ID: #N:gabriel:61800001:000:2293
Nf-From: gabriel.UUCP!MAILER-DAEMON    May 23 04:48:00 1986