From: Jeremy Allison Date: Tue, 1 May 2018 18:08:40 +0000 (-0700) Subject: s3: printing: Use auto-updating of offset in printing_pread_data() to remove offset... X-Git-Tag: ldb-1.4.0~419 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09aaed21091144c48586fdc97233166b2402f6b4;p=thirdparty%2Fsamba.git s3: printing: Use auto-updating of offset in printing_pread_data() to remove offset tracking in get_file_version(). Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 1a31199d6ab..f4e2768e536 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -732,9 +732,7 @@ static int get_file_version(files_struct *fsp, { char *buf = NULL; ssize_t byte_count; - off_t pos; - off_t oret; - off_t in_pos = -1; + off_t in_pos = fsp->fh->pos; buf=(char *)SMB_MALLOC(DOS_HEADER_SIZE); if (buf == NULL) { @@ -764,19 +762,7 @@ static int get_file_version(files_struct *fsp, * Skip OEM header (if any) and the * DOS stub to start of Windows header. */ - pos = SVAL(buf,DOS_HEADER_LFANEW_OFFSET); - oret = SMB_VFS_LSEEK(fsp, pos, SEEK_SET); - if (oret == (off_t)-1) { - DBG_NOTICE("File [%s] too short, errno = %d\n", - fname, - errno); - /* - * Assume this isn't an error... - * the file just looks sort of like a PE/NE file. - */ - goto no_version_info; - } - pos = oret; /* Update new position. */ + in_pos = SVAL(buf,DOS_HEADER_LFANEW_OFFSET); /* Note: DOS_HEADER_SIZE and NE_HEADER_SIZE are incidentally same */ byte_count = printing_pread_data(fsp, buf, &in_pos, NE_HEADER_SIZE);