s3: printing: Use offset tracking in printing_pread_data() to remove the seek in...
authorJeremy Allison <jra@samba.org>
Tue, 1 May 2018 18:19:49 +0000 (11:19 -0700)
committerRalph Boehme <slow@samba.org>
Fri, 4 May 2018 20:34:24 +0000 (22:34 +0200)
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 <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/printing/nt_printing.c

index dbcf71a4cdbb1505860cb64602d7a565e5c67b24..328964579d875908fe39cdff64fdbec211ea0aed 100644 (file)
@@ -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,