[libdvdcss-devel] Fix position after partial read in libc_read

[email protected] (Evgeny Grin) Tue, 27 Jan 2015 15:40:26 +0100 (CET)
Newsgroups gmane.comp.video.videolan.libdvdcss,gmane.comp.video.videolan.libdvdcss.devel
Message-ID <[email protected]>
libdvdcss | branch: master | Evgeny Grin <[email protected]> | Tue Jan 27 15:39:10 2015 +0100| [2ce12e9e2b52955c20804845840d2239fe279674] | committer: Jean-Baptiste Kempf

Fix position after partial read in libc_read

Signed-off-by: Jean-Baptiste Kempf <[email protected]>

> http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=2ce12e9e2b52955c20804845840d2239fe279674
---

 src/device.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/device.c b/src/device.c
index 77c9821..50fc754 100644
--- a/src/device.c
+++ b/src/device.c
@@ -578,10 +578,11 @@ static int libc_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
     /* Handle partial reads */
     if( i_ret != i_size )
     {
-        int i_seek;
+        int i_seek, i_set_pos;
 
+        i_set_pos = dvdcss->i_pos + i_ret_blocks;
         dvdcss->i_pos = -1;
-        i_seek = libc_seek( dvdcss, i_ret_blocks );
+        i_seek = libc_seek( dvdcss, i_set_pos );
         if( i_seek < 0 )
         {
             return i_seek;

_______________________________________________
libdvdcss-devel mailing list
[email protected]
https://mailman.videolan.org/listinfo/libdvdcss-devel