diff options
Diffstat (limited to 'source3/printing')
-rw-r--r-- | source3/printing/printing.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 8b93a43311..d9bc13d03a 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -159,8 +159,6 @@ static void rap_jobid_delete(int snum, uint32 jobid) tdb_delete(rap_tdb, data); } -static pid_t local_pid; - static int get_queue_status(int, print_status_struct *); /**************************************************************************** @@ -174,15 +172,10 @@ BOOL print_backend_init(void) int services = lp_numservices(); int snum; - if (local_pid == sys_getpid()) - return True; - unlink(lock_path("printing.tdb")); pstrcpy(printing_path,lock_path("printing")); mkdir(printing_path,0755); - local_pid = sys_getpid(); - /* handle a Samba upgrade */ for (snum = 0; snum < services; snum++) { @@ -599,6 +592,7 @@ void pjob_delete(int snum, uint32 jobid) /* Remove from printing.tdb */ tdb_delete(pdb->tdb, print_key(jobid)); + remove_from_jobs_changed(snum, jobid); release_print_db(pdb); rap_jobid_delete(snum, jobid); } @@ -1448,7 +1442,7 @@ int print_job_fd(int snum, uint32 jobid) if (!pjob) return -1; /* don't allow another process to get this info - it is meaningless */ - if (pjob->pid != local_pid) + if (pjob->pid != sys_getpid()) return -1; return pjob->fd; } @@ -1462,7 +1456,7 @@ int print_job_fd(int snum, uint32 jobid) char *print_job_fname(int snum, uint32 jobid) { struct printjob *pjob = print_job_find(snum, jobid); - if (!pjob || pjob->spooled || pjob->pid != local_pid) + if (!pjob || pjob->spooled || pjob->pid != sys_getpid()) return NULL; return pjob->filename; } @@ -1501,7 +1495,7 @@ BOOL print_job_set_place(int snum, uint32 jobid, int place) BOOL print_job_set_name(int snum, uint32 jobid, char *name) { struct printjob *pjob = print_job_find(snum, jobid); - if (!pjob || pjob->pid != local_pid) + if (!pjob || pjob->pid != sys_getpid()) return False; fstrcpy(pjob->jobname, name); @@ -1598,8 +1592,6 @@ static BOOL print_job_delete1(int snum, uint32 jobid) if (pjob->spooled && pjob->sysjob != -1) result = (*(current_printif->job_delete))(snum, pjob); - else - remove_from_jobs_changed(snum, jobid); /* Delete the tdb entry if the delete succeeded or the job hasn't been spooled. */ @@ -1814,7 +1806,7 @@ int print_job_write(int snum, uint32 jobid, const char *buf, int size) if (!pjob) return -1; /* don't allow another process to get this info - it is meaningless */ - if (pjob->pid != local_pid) + if (pjob->pid != sys_getpid()) return -1; return_code = write(pjob->fd, buf, size); @@ -2079,7 +2071,7 @@ uint32 print_job_start(struct current_user *user, int snum, char *jobname, NT_DE ZERO_STRUCT(pjob); - pjob.pid = local_pid; + pjob.pid = sys_getpid(); pjob.sysjob = -1; pjob.fd = -1; pjob.starttime = time(NULL); @@ -2149,7 +2141,7 @@ void print_job_endpage(int snum, uint32 jobid) if (!pjob) return; /* don't allow another process to get this info - it is meaningless */ - if (pjob->pid != local_pid) + if (pjob->pid != sys_getpid()) return; pjob->page_count++; @@ -2172,7 +2164,7 @@ BOOL print_job_end(int snum, uint32 jobid, BOOL normal_close) if (!pjob) return False; - if (pjob->spooled || pjob->pid != local_pid) + if (pjob->spooled || pjob->pid != sys_getpid()) return False; if (normal_close && (sys_fstat(pjob->fd, &sbuf) == 0)) { @@ -2228,7 +2220,6 @@ fail: /* Still need to add proper error return propagation! 010122:JRR */ unlink(pjob->filename); pjob_delete(snum, jobid); - remove_from_jobs_changed(snum, jobid); return False; } |