summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-01-10 01:21:59 +0000
committerJeremy Allison <jra@samba.org>2003-01-10 01:21:59 +0000
commit545087c060ee9bf3d2a092f4d99c79426e4a0ecb (patch)
treecd23815e1a865706bcbf57c956b010b628ec4b17
parentd221b11bc6d62663544d0580321d088152332ec4 (diff)
downloadsamba-545087c060ee9bf3d2a092f4d99c79426e4a0ecb.tar.gz
samba-545087c060ee9bf3d2a092f4d99c79426e4a0ecb.tar.bz2
samba-545087c060ee9bf3d2a092f4d99c79426e4a0ecb.zip
Don't delete jobs subitted after the lpq time.
Jeremy. (This used to be commit 6cb9f6ccb1fab3ff597f52c931561d52de09e84a)
-rw-r--r--source3/printing/printing.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 711d99f394..be42664b56 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -610,6 +610,7 @@ static void print_unix_job(int snum, print_queue_struct *q)
struct traverse_struct {
print_queue_struct *queue;
int qcount, snum, maxcount, total_jobs;
+ time_t lpq_time;
};
/****************************************************************************
@@ -674,17 +675,15 @@ static int traverse_fn_delete(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void
completed, so delete the database entry. */
if (i == ts->qcount) {
- time_t cur_t = time(NULL);
/* A race can occur between the time a job is spooled and
when it appears in the lpq output. This happens when
the job is added to printing.tdb when another smbd
running print_queue_update() has completed a lpq and
is currently traversing the printing tdb and deleting jobs.
- A workaround is to not delete the job if it has been
- submitted less than lp_lpqcachetime() seconds ago. */
+ Don't delete the job if it was submitted after the lpq_time. */
- if ((cur_t - pjob.starttime) > lp_lpqcachetime())
+ if (pjob.starttime < ts->lpq_time)
pjob_delete(ts->snum, jobid);
else
ts->total_jobs++;
@@ -906,6 +905,7 @@ static void print_queue_update(int snum)
tstruct.qcount = qcount;
tstruct.snum = snum;
tstruct.total_jobs = 0;
+ tstruct.lpq_time = time(NULL);
tdb_traverse(pdb->tdb, traverse_fn_delete, (void *)&tstruct);