summaryrefslogtreecommitdiff
path: root/source3/printing/printing.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/printing/printing.c')
-rw-r--r--source3/printing/printing.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 753d0f7f96..d98c7c4d4c 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -386,7 +386,7 @@ static void print_queue_update(int snum)
/* get the current queue using the appropriate interface */
ZERO_STRUCT(status);
- qcount = (*(current_printif->queue_get))(snum, &queue, &status);
+ qcount = (*(current_printif->queue_get))(snum, &queue, &status);
DEBUG(3, ("%d job%s in queue for %s\n", qcount, (qcount != 1) ?
"s" : "", printer_name));
@@ -575,7 +575,7 @@ static BOOL print_job_delete1(int jobid)
print_job_store(jobid, pjob);
if (pjob->spooled && pjob->sysjob != -1)
- result = (*(current_printif->job_delete))(snum, pjob);
+ result = (*(current_printif->job_delete))(snum, pjob);
/* Delete the tdb entry if the delete suceeded or the job hasn't
been spooled. */
@@ -667,7 +667,7 @@ BOOL print_job_pause(struct current_user *user, int jobid, int *errcode)
}
/* need to pause the spooled entry */
- ret = (*(current_printif->job_pause))(snum, pjob);
+ ret = (*(current_printif->job_pause))(snum, pjob);
if (ret != 0) {
*errcode = ERROR_INVALID_PARAMETER;
@@ -892,7 +892,6 @@ int print_job_start(struct current_user *user, int snum, char *jobname)
/* lock the database */
tdb_lock_bystring(tdb, "INFO/nextjob");
- next_jobnum:
next_jobid = tdb_fetch_int(tdb, "INFO/nextjob");
if (next_jobid == -1) next_jobid = 1;
@@ -906,18 +905,10 @@ int print_job_start(struct current_user *user, int snum, char *jobname)
tdb_store_int(tdb, "INFO/nextjob", jobid);
- /* we have a job entry - now create the spool file
-
- we unlink first to cope with old spool files and also to beat
- a symlink security hole - it allows us to use O_EXCL
- There may be old spool files owned by other users lying around.
- */
- slprintf(pjob.filename, sizeof(pjob.filename)-1, "%s/%s%d",
- path, PRINT_SPOOL_PREFIX, jobid);
- if (unlink(pjob.filename) == -1 && errno != ENOENT) {
- goto next_jobnum;
- }
- pjob.fd = sys_open(pjob.filename,O_WRONLY|O_CREAT|O_EXCL,0600);
+ /* we have a job entry - now create the spool file */
+ slprintf(pjob.filename, sizeof(pjob.filename)-1, "%s/%sXXXXXX",
+ path, PRINT_SPOOL_PREFIX);
+ pjob.fd = smb_mkstemp(pjob.filename);
if (pjob.fd == -1) {
if (errno == EACCES) {