diff options
author | Gerald Carter <jerry@samba.org> | 2004-09-08 20:57:29 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2004-09-08 20:57:29 +0000 |
commit | e3f4833aec59d4cbd27a465f41543cc657b58a83 (patch) | |
tree | 334ef7e6b4fe8caca3bfc1ce0f8538582930f137 /source/printing/printing.c | |
parent | f42202ba00e30286caaa45b5cfdf8b488957cf24 (diff) | |
download | samba-e3f4833aec59d4cbd27a465f41543cc657b58a83.tar.gz samba-e3f4833aec59d4cbd27a465f41543cc657b58a83.tar.xz samba-e3f4833aec59d4cbd27a465f41543cc657b58a83.zip |
r2260: merging from 3.0 (and updating WHATSNEW)
svn merge -r 2177:2188 $SVNURL/branches/SAMBA_3_0
svn merge -r 2188:2189 $SVNURL/branches/SAMBA_3_0
svn merge -r 2189:2190 $SVNURL/branches/SAMBA_3_0
svn merge -r 2190:2191 $SVNURL/branches/SAMBA_3_0
svn merge -r 2196:2198 $SVNURL/branches/SAMBA_3_0
svn merge -r 2219:2224 $SVNURL/branches/SAMBA_3_0
svn merge -r 2231:2233 $SVNURL/branches/SAMBA_3_0
Diffstat (limited to 'source/printing/printing.c')
-rw-r--r-- | source/printing/printing.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/source/printing/printing.c b/source/printing/printing.c index 8b93a433115..d9bc13d03a2 100644 --- a/source/printing/printing.c +++ b/source/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; } |