lpq segmentation fault on some systems
Steve Hubert
hubert at entropy.ms.washington.edu
Sat Feb 6 06:03:51 AEST 1988
Index: usr.lib/lpr/lpq 4.3BSD Fix
Description:
Code in /usr/src/usr.lib/lpr/displayq.c causes segmentation
faults on some non-VAX systems (e.g., 3B2, IBM RT).
Repeat-By:
On an IBM RT running ACIS 4.3BSD, print a file to a remote printer
and run lpq before the job has finished transferring to the
remote host.
Fix:
Below is a context diff.
============================================================
*** displayq.c_orig Sat Jan 11 11:41:33 1986
--- displayq.c Thu Jan 28 17:03:50 1988
***************
*** 1,3 ****
--- 1,4 ----
+
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
***************
*** 178,188 ****
warn();
else {
register char *cp;
/* get daemon pid */
cp = current;
! while ((*cp = getc(fp)) != EOF && *cp != '\n')
! cp++;
*cp = '\0';
i = atoi(current);
if (i <= 0 || kill(i, 0) < 0)
--- 179,190 ----
warn();
else {
register char *cp;
+ register int c;
/* get daemon pid */
cp = current;
! while ((c = getc(fp)) != EOF && c != '\n')
! *cp++ = c;
*cp = '\0';
i = atoi(current);
if (i <= 0 || kill(i, 0) < 0)
***************
*** 190,197 ****
else {
/* read current file name */
cp = current;
! while ((*cp = getc(fp)) != EOF && *cp != '\n')
! cp++;
*cp = '\0';
/*
* Print the status file.
--- 192,199 ----
else {
/* read current file name */
cp = current;
! while ((c = getc(fp)) != EOF && c != '\n')
! *cp++ = c;
*cp = '\0';
/*
* Print the status file.
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list