diff options
author | Jeremy Allison <jra@samba.org> | 2018-05-01 11:08:40 -0700 |
---|---|---|
committer | Ralph Boehme <slow@samba.org> | 2018-05-04 22:34:24 +0200 |
commit | 09aaed21091144c48586fdc97233166b2402f6b4 (patch) | |
tree | 26f669ecc56fbcd910c205424eee33b2bbd5edba /source3/printing | |
parent | 4b580ee94e8b40ed260d215766d8692ceb2cda13 (diff) | |
download | samba-09aaed21091144c48586fdc97233166b2402f6b4.tar.gz |
s3: printing: Use auto-updating of offset in printing_pread_data() to remove offset tracking in get_file_version().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'source3/printing')
-rw-r--r-- | source3/printing/nt_printing.c | 18 |
1 files changed, 2 insertions, 16 deletions
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); |