diff options
author | Jeremy Allison <jra@samba.org> | 2018-05-01 11:47:24 -0700 |
---|---|---|
committer | Ralph Boehme <slow@samba.org> | 2018-05-04 22:34:24 +0200 |
commit | 70eb53366995e842f0f29733979a13b6738ffb1a (patch) | |
tree | e0a0f62fb9ca47922164ef4c4ac1c0abdcbbecb8 /source3/printing | |
parent | 9bf5d0da9516635eef5af246a3c7b5f3b0648f74 (diff) | |
download | samba-70eb53366995e842f0f29733979a13b6738ffb1a.tar.gz |
s3: printing: Now we never pass an offset of -1, remove the off_t==-1 protections from printing_pread_data().
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 | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 328964579d8..6bc48ae3634 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -324,15 +324,13 @@ static ssize_t printing_pread_data(files_struct *fsp, size_t total=0; off_t in_pos = *poff; - if (in_pos != (off_t)-1) { - in_pos = SMB_VFS_LSEEK(fsp, in_pos, SEEK_SET); - if (in_pos == (off_t)-1) { - return -1; - } - /* Don't allow integer wrap on read. */ - if (in_pos + byte_count < in_pos) { - return -1; - } + in_pos = SMB_VFS_LSEEK(fsp, in_pos, SEEK_SET); + if (in_pos == (off_t)-1) { + return -1; + } + /* Don't allow integer wrap on read. */ + if (in_pos + byte_count < in_pos) { + return -1; } while (total < byte_count) { @@ -340,9 +338,7 @@ static ssize_t printing_pread_data(files_struct *fsp, byte_count - total); if (ret == 0) { - if (*poff != (off_t)-1) { - *poff = in_pos; - } + *poff = in_pos; return total; } if (ret == -1) { @@ -355,9 +351,7 @@ static ssize_t printing_pread_data(files_struct *fsp, in_pos += ret; total += ret; } - if (*poff != (off_t)-1) { - *poff = in_pos; - } + *poff = in_pos; return (ssize_t)total; } |