summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-03-19 02:35:12 +0000
committerJeremy Allison <jra@samba.org>2002-03-19 02:35:12 +0000
commit72eb7dbd40b4faf3438951c297fb1fbf6f9011ac (patch)
tree24590ea1fa7876843072ebb00a4db26ad6986ca6 /source3/printing
parentffadd471b9664018b3010ab5d74e6d05b8886e66 (diff)
downloadsamba-72eb7dbd40b4faf3438951c297fb1fbf6f9011ac.tar.gz
samba-72eb7dbd40b4faf3438951c297fb1fbf6f9011ac.tar.bz2
samba-72eb7dbd40b4faf3438951c297fb1fbf6f9011ac.zip
Merge in JohnR's page count fixes.
Jeremy. (This used to be commit 2e3133fbe5531b9bbc9bf46a04b27fa58e555f5a)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/printing.c35
1 files changed, 31 insertions, 4 deletions
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;
}
/****************************************************************************
@@ -1044,6 +1053,23 @@ to open spool file %s.\n", pjob.filename));
}
/****************************************************************************
+ 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
error.
@@ -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;