From af8a691db11a5072865f8b03fd1cbd3aab5cb6d7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 8 Jul 2005 04:51:27 +0000 Subject: r8219: Merge the new open code from HEAD to 3.0. Haven't yet run the torture tests on this as it's very late NY time (just wanted to get this work into the tree). I'll test this over the weekend.... Jerry - in looking at the difference between the two trees there seem to be some printing/ntprinting.c and registry changes we might want to examine to try keep in sync. Jeremy. (This used to be commit c7fe18761e2c753afbffd3a78abff46472a9b8eb) --- source3/printing/printfsp.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'source3/printing/printfsp.c') diff --git a/source3/printing/printfsp.c b/source3/printing/printfsp.c index 863de9624e..eb81dc4536 100644 --- a/source3/printing/printfsp.c +++ b/source3/printing/printfsp.c @@ -28,7 +28,7 @@ open a print file and setup a fsp for it. This is a wrapper around print_job_start(). ***************************************************************************/ -files_struct *print_fsp_open(connection_struct *conn, char *fname) +files_struct *print_fsp_open(connection_struct *conn, const char *fname) { int jobid; SMB_STRUCT_STAT sbuf; @@ -40,10 +40,11 @@ files_struct *print_fsp_open(connection_struct *conn, char *fname) fstrcpy( name, "Remote Downlevel Document"); if (fname) { - char *p = strrchr(fname, '/'); + const char *p = strrchr(fname, '/'); fstrcat(name, " "); - if (!p) + if (!p) { p = fname; + } fstrcat(name, p); } @@ -63,24 +64,23 @@ files_struct *print_fsp_open(connection_struct *conn, char *fname) } /* setup a full fsp */ - fsp->fd = print_job_fd(lp_const_servicename(SNUM(conn)),jobid); + fsp->fh->fd = print_job_fd(lp_const_servicename(SNUM(conn)),jobid); GetTimeOfDay(&fsp->open_time); fsp->vuid = current_user.vuid; - fsp->pos = -1; + fsp->fh->pos = -1; fsp->can_lock = True; fsp->can_read = False; + fsp->access_mask = FILE_GENERIC_WRITE; fsp->can_write = True; - fsp->share_mode = 0; fsp->print_file = True; fsp->modified = False; fsp->oplock_type = NO_OPLOCK; fsp->sent_oplock_break = NO_BREAK_SENT; fsp->is_directory = False; - fsp->directory_delete_on_close = False; string_set(&fsp->fsp_name,print_job_fname(lp_const_servicename(SNUM(conn)),jobid)); fsp->wbmpx_ptr = NULL; fsp->wcp = NULL; - SMB_VFS_FSTAT(fsp,fsp->fd, &sbuf); + SMB_VFS_FSTAT(fsp,fsp->fh->fd, &sbuf); fsp->mode = sbuf.st_mode; fsp->inode = sbuf.st_ino; fsp->dev = sbuf.st_dev; @@ -91,19 +91,20 @@ files_struct *print_fsp_open(connection_struct *conn, char *fname) } /**************************************************************************** -print a file - called on closing the file + Print a file - called on closing the file. ****************************************************************************/ + void print_fsp_end(files_struct *fsp, BOOL normal_close) { uint32 jobid; fstring sharename; - if (fsp->share_mode == FILE_DELETE_ON_CLOSE) { + if (fsp->fh->private_options & FILE_DELETE_ON_CLOSE) { /* * Truncate the job. print_job_end will take * care of deleting it for us. JRA. */ - sys_ftruncate(fsp->fd, 0); + sys_ftruncate(fsp->fh->fd, 0); } if (fsp->fsp_name) { -- cgit