From 4703248a8e7287b738fa82edfd91fb2b13e7c222 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 8 Feb 2003 01:04:43 +0000 Subject: Ensure we return NOSPACE if we can't fast allocate a print job. Jeremy. (This used to be commit 82cf8aa74794649fb16c336011ca48d549d6abb8) --- source3/printing/printing.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source3/printing/printing.c b/source3/printing/printing.c index a46fff0de2..3bf992ad69 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -1595,6 +1595,8 @@ static BOOL allocate_print_jobid(struct tdb_print_db *pdb, int snum, const char if (i > 2) { DEBUG(0, ("allocate_print_jobid: failed to allocate a print job for queue %s\n", printername )); + /* Probably full... */ + errno = ENOSPC; return False; } @@ -1669,13 +1671,16 @@ uint32 print_job_start(struct current_user *user, int snum, char *jobname, NT_DE /* Insure the maximum queue size is not violated */ if ((njobs = print_queue_length(snum,NULL)) > lp_maxprintjobs(snum)) { - DEBUG(3, ("print_job_start: number of jobs (%d) larger than max printjobs per queue (%d).\n", - njobs, lp_maxprintjobs(snum) )); + DEBUG(3, ("print_job_start: Queue %s number of jobs (%d) larger than max printjobs per queue (%d).\n", + printername, njobs, lp_maxprintjobs(snum) )); release_print_db(pdb); errno = ENOSPC; return (uint32)-1; } + DEBUG(10,("print_job_start: Queue %s number of jobs (%d), max printjobs = %d\n", + printername, njobs, lp_maxprintjobs(snum) )); + if (!allocate_print_jobid(pdb, snum, printername, &jobid)) goto fail; -- cgit