Article View: comp.bugs.sys5
Article #1109bug in lpsched
From: L. Mark Larsen
Date: Fri, 12 May 1989 23:42
Date: Fri, 12 May 1989 23:42
47 lines
2656 bytes
2656 bytes
There is a small bug in lpsched (SVR2 up to at least SVR3.1) that causes
a spurious error message when a print request fails. If you set up
your interface script right, this can be gotten around. For those with
source, the problem is in lpsched.c in postprint(). Here is the problem
section:
else { /* printer interface exited */
resetstatus(1, 1); /* dequeue request */
if(excode != 0) {
sprintf(errmsg,
"error code %d in request %s-%d on printer %s",
excode, dst, seqno, pr);
wrtmail(logname, errmsg);
}
else { /* no errors detected by interface pgm */
fclose(rfile);
unlink(rname);
The real problem here is that resetstatus() tries to remove the rfile
(and corresponding dfile(s), if any) without having first closed it.
Of course, the files are removed when this incarnation of lpsched exits
but not before causing the main scheduler to believe that the request
is still valid! So, if the printer were automatically disabled by the
interface script upon failure, the next time it is enabled, lpsched tries
to print a non-existant request which causes preprint() to send a second
mail message to the puzzled user.
For those who like to debate these issues, I wonder if it is a good idea
to remove the print request upon failure or to leave it to the interface
script to decide. The latter choice seemed to have been taken in SVR0
(since we never had the observed troubles when running that version)
so I decided to do the same:
else { /* printer interface exited */
fclose(rfile);
if(excode != 0) {
resetstatus(0, 1); /* don't dequeue request */
sprintf(errmsg,
"error code %d in request %s-%d on printer %s",
excode, dst, seqno, pr);
wrtmail(logname, errmsg);
}
else { /* no errors detected by interface pgm */
resetstatus(1, 1); /* dequeue request */
cheers,
-lml
Technical Details
Message-ID:
<6541@cbnews.ATT.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!ukma!rutgers!att!cbnews!lmlShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!ukma!rutgers!att!cbnews!lml From: lml@cbnews.ATT.COM (L. Mark Larsen) Newsgroups: comp.bugs.sys5 Subject: bug in lpsched Message-ID: <6541@cbnews.ATT.COM> Date: 12 May 89 23:42:30 GMT Reply-To: lml@cbnews.ATT.COM (L. Mark Larsen) Organization: AT&T Bell Laboratories Lines: 47