From c237db1c11d59c9715c65dc808817483e04903e2 Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Thu, 15 Feb 2001 19:33:57 +0000 Subject: DEBUG merge from 2.2 about tdb init failure. Patch from David Collier-Brown to print permission error on spool file creation. (This used to be commit 8907a51743b7b9b9ad4168033fae4d44012cca37) --- source3/printing/printing.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'source3') diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 4dbb01e839..9ed33bc6ae 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -76,7 +76,9 @@ BOOL print_backend_init(void) if (tdb && local_pid == sys_getpid()) return True; tdb = tdb_open(lock_path("printing.tdb"), 0, 0, O_RDWR|O_CREAT, 0600); if (!tdb) { - DEBUG(0,("Failed to open printing backend database\n")); + DEBUG(0,("print_backend_init: Failed to open printing backend database. Error = [%s]\n", + tdb_errorstr(tdb))); + return False; } local_pid = sys_getpid(); @@ -920,7 +922,23 @@ int print_job_start(struct current_user *user, int snum, char *jobname) goto next_jobnum; } pjob.fd = sys_open(pjob.filename,O_WRONLY|O_CREAT|O_EXCL,0600); - if (pjob.fd == -1) goto fail; + if (pjob.fd == -1) { + if (errno == EACCES) { + /* Common setup error, force a report. */ + DEBUG(0, ("print_job_start: insufficient permissions " + "to open spool file %s.\n", + pjob.filename)); + } + else { + /* Normal case, report at level 3 and above.*/ + DEBUG(3, ("print_job_start: can't open spool " + "file %s,\n", + pjob.filename)); + DEBUGADD(3, ("errno = %d (%s).\n", errno, + strerror(errno))); + } + goto fail; + } print_job_store(jobid, &pjob); -- cgit