From e31bf053633440bc3ceceb9208bb857fe94237a0 Mon Sep 17 00:00:00 2001 From: David O'Neill Date: Wed, 24 Jan 2001 16:46:08 +0000 Subject: Changes from APPLIANCE_HEAD: source/printing/printing.c - When deleting a job, remove the entry from the back-end database if the delete succeeded. This stops a spurious permission denied message appearing if the forced database update is within the lpq cache timeout and doesn't actually delete the job from the database. (This used to be commit be61c98832d0a8969e608fd22da2035e454ec788) --- source3/printing/printing.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'source3/printing') diff --git a/source3/printing/printing.c b/source3/printing/printing.c index e459721826..46d872df7c 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -538,7 +538,7 @@ delete a print job - don't update queue static BOOL print_job_delete1(int jobid) { struct printjob *pjob = print_job_find(jobid); - int snum; + int snum, result = 0; if (!pjob) return False; @@ -553,17 +553,26 @@ static BOOL print_job_delete1(int jobid) } if (pjob->spooled && pjob->sysjob != -1) { - /* need to delete the spooled entry */ fstring jobstr; + + /* need to delete the spooled entry */ slprintf(jobstr, sizeof(jobstr), "%d", pjob->sysjob); - print_run_command(snum, - lp_lprmcommand(snum), NULL, - "%j", jobstr, - "%T", http_timestring(pjob->starttime), - NULL); + result = print_run_command( + snum, + lp_lprmcommand(snum), NULL, + "%j", jobstr, + "%T", http_timestring(pjob->starttime), + NULL); } - return True; + /* Delete the tdb entry if the delete suceeded or the job hasn't + been spooled. */ + + if (result == 0) { + tdb_delete(tdb, print_key(jobid)); + } + + return (result == 0); } /**************************************************************************** -- cgit