From: Jeremy Allison Date: Tue, 1 May 2018 18:19:49 +0000 (-0700) Subject: s3: printing: Use offset tracking in printing_pread_data() to remove the seek in... X-Git-Tag: ldb-1.4.0~416 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9bf5d0da9516635eef5af246a3c7b5f3b0648f74;p=thirdparty%2Fsamba.git s3: printing: Use offset tracking in printing_pread_data() to remove the seek in handle_ne_file(). Uses the fact that: lseek(fd, 0, SEEK_CUR) is merely getting the current file position, which we have already tracked in in_pos. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index dbcf71a4cdb..328964579d8 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -546,7 +546,7 @@ static int handle_pe_file(files_struct *fsp, ****************************************************************************/ static int handle_ne_file(files_struct *fsp, - off_t in_pos_unused, + off_t in_pos, char *fname, char *buf, uint32_t *major, @@ -555,7 +555,6 @@ static int handle_ne_file(files_struct *fsp, unsigned int i; ssize_t byte_count; int ret = -1; - off_t in_pos = -1; if (CVAL(buf,NE_HEADER_TARGET_OS_OFFSET) != NE_HEADER_TARGOS_WIN ) { DBG_NOTICE("NE file [%s] wrong target OS = 0x%x\n", @@ -658,10 +657,7 @@ static int handle_ne_file(files_struct *fsp, * Compute skip alignment to next * long address. */ - off_t cpos = SMB_VFS_LSEEK(fsp, - 0, - SEEK_CUR); - + off_t cpos = in_pos; int skip = -(cpos - (byte_count - i) + sizeof(VS_SIGNATURE)) & 3; if (IVAL(buf,