From 72eb7dbd40b4faf3438951c297fb1fbf6f9011ac Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 19 Mar 2002 02:35:12 +0000 Subject: Merge in JohnR's page count fixes. Jeremy. (This used to be commit 2e3133fbe5531b9bbc9bf46a04b27fa58e555f5a) --- source3/printing/printing.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'source3/printing') diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 97eaaebcc4..7e1f59f590 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -796,12 +796,21 @@ write to a print file ****************************************************************************/ int print_job_write(int jobid, const char *buf, int size) { - int fd; + int return_code; + struct printjob *pjob = print_job_find(jobid); - fd = print_job_fd(jobid); - if (fd == -1) return -1; + if (!pjob) + return -1; + /* don't allow another process to get this info - it is meaningless */ + if (pjob->pid != local_pid) + return -1; - return write(fd, buf, size); + return_code = write(pjob->fd, buf, size); + if (return_code>0) { + pjob->size += size; + print_job_store(jobid, pjob); + } + return return_code; } /**************************************************************************** @@ -1043,6 +1052,23 @@ to open spool file %s.\n", pjob.filename)); return -1; } +/**************************************************************************** + Update the number of pages spooled to jobid +****************************************************************************/ + +void print_job_endpage(int jobid) +{ + struct printjob *pjob = print_job_find(jobid); + if (!pjob) + return; + /* don't allow another process to get this info - it is meaningless */ + if (pjob->pid != local_pid) + return; + + pjob->page_count++; + print_job_store(jobid, pjob); +} + /**************************************************************************** Print a file - called on closing the file. This spools the job. If normal close is false then we're tearing down the jobs - treat as an @@ -1137,6 +1163,7 @@ static int traverse_fn_queue(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void * ts->queue[i].job = jobid; ts->queue[i].size = pjob.size; + ts->queue[i].page_count = pjob.page_count; ts->queue[i].status = pjob.status; ts->queue[i].priority = 1; ts->queue[i].time = pjob.starttime; -- cgit