1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-04 17:47:26 +03:00

DEBUG merge from 2.2 about tdb init failure.

Patch from David Collier-Brown to print permission error on spool file
creation.
This commit is contained in:
Herb Lewis -
parent ec217eb8fc
commit 8907a51743

View File

@ -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);