summaryrefslogtreecommitdiff
path: root/source3/printing/printfsp.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-03-30 15:27:26 -0700
committerJeremy Allison <jra@samba.org>2010-03-30 15:27:26 -0700
commit32c8feab5d8320cba7f47fc27ba0fc264f3c4333 (patch)
tree1d1c304025914cb341097c790e2fe4e60c0fce5a /source3/printing/printfsp.c
parent4b249a616b586bf384e0ba68ce5d391601879938 (diff)
downloadsamba-32c8feab5d8320cba7f47fc27ba0fc264f3c4333.tar.gz
samba-32c8feab5d8320cba7f47fc27ba0fc264f3c4333.tar.bz2
samba-32c8feab5d8320cba7f47fc27ba0fc264f3c4333.zip
Fix for bug #7233 - print fails with jobs >4GB from Win7 clients.
Contains for by Sebastian Kloska <oncaphillis@snafu.de>. Submitter confirms this fixes the problem. Jeremy.
Diffstat (limited to 'source3/printing/printfsp.c')
-rw-r--r--source3/printing/printfsp.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source3/printing/printfsp.c b/source3/printing/printfsp.c
index 756a314dd7..5382b734f3 100644
--- a/source3/printing/printfsp.c
+++ b/source3/printing/printfsp.c
@@ -114,3 +114,23 @@ void print_fsp_end(files_struct *fsp, enum file_close_type close_type)
print_job_end(SNUM(fsp->conn),jobid, close_type);
}
+
+/****************************************************************************
+ Discovered by Sebastian Kloska <oncaphillis@snafu.de>. When print files
+ go beyond 4GB, the 32-bit offset sent in old SMBwrite calls is relative
+ to the current 4GB chunk we're writing to.
+****************************************************************************/
+
+SMB_OFF_T printfile_offset(files_struct *fsp, SMB_OFF_T offset)
+{
+ SMB_STRUCT_STAT st;
+
+ if (sys_fstat(fsp->fh->fd, &st, false) == -1) {
+ DEBUG(3,("printfile_offset: sys_fstat failed on %s (%s)\n",
+ fsp_str_dbg(fsp),
+ strerror(errno) ));
+ return offset;
+ }
+
+ return (st.st_ex_size & 0xffffffff00000000LL) + offset;
+}