lpd long file bug
Steven M. Schultz
sms at wlv.imsd.contel.com
Fri Aug 25 15:59:17 AEST 1989
Subject: lpd long file bug
Index: usr.lib/lpr/printjob.c 2.10BSD
Description:
two more "long" vs. "int" gotchas have surfaced in the "lpd"
program. one of these days the last of these long/int bugs
will be terminated!
Repeat-By:
by examination and trying to print a file longer than 32kb.
Fix:
Apply the following patch to lpr/printjob.c
*** printjob.c.old Sun Dec 25 23:52:14 1988
--- printjob.c Thu Aug 24 11:15:14 1989
***************
*** 705,711 ****
sendfile(type, file)
char type, *file;
{
! register int f, i, amt;
struct stat stb;
char buf[BUFSIZ];
int sizerr, resp;
--- 705,712 ----
sendfile(type, file)
char type, *file;
{
! register int f, amt;
! long i;
struct stat stb;
char buf[BUFSIZ];
int sizerr, resp;
***************
*** 720,726 ****
if ((stb.st_mode & S_IFMT) == S_IFLNK && fstat(f, &stb) == 0 &&
(stb.st_dev != fdev || stb.st_ino != fino))
return(ACCESS);
! (void) sprintf(buf, "%c%d %s\n", type, stb.st_size, file);
amt = strlen(buf);
for (i = 0; ; i++) {
if (write(pfd, buf, amt) != amt ||
--- 721,727 ----
if ((stb.st_mode & S_IFMT) == S_IFLNK && fstat(f, &stb) == 0 &&
(stb.st_dev != fdev || stb.st_ino != fino))
return(ACCESS);
! (void) sprintf(buf, "%c%ld %s\n", type, stb.st_size, file);
amt = strlen(buf);
for (i = 0; ; i++) {
if (write(pfd, buf, amt) != amt ||
More information about the Comp.bugs.2bsd
mailing list