Thread View: comp.bugs.sys5
1 messages
1 total messages
Started by L. Mark Larsen
Fri, 12 May 1989 23:42
bug in lpsched
Author: 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
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