From 32c8feab5d8320cba7f47fc27ba0fc264f3c4333 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 30 Mar 2010 15:27:26 -0700 Subject: Fix for bug #7233 - print fails with jobs >4GB from Win7 clients. Contains for by Sebastian Kloska . Submitter confirms this fixes the problem. Jeremy. --- source3/printing/printfsp.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'source3/printing/printfsp.c') 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 . 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; +} -- cgit