[libdvdnav-devel] Warn when lseek is incomplete in file_read

Jean-Baptiste Kempf git at videolan.org
Mon Aug 4 19:45:18 CEST 2014


libdvdread | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Aug  4 19:44:40 2014 +0200| [849f6e58cc8812838be47045959eca400a80ef7d] | committer: Jean-Baptiste Kempf

Warn when lseek is incomplete in file_read

> http://git.videolan.org/gitweb.cgi/libdvdread.git/?a=commit;h=849f6e58cc8812838be47045959eca400a80ef7d
---

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

diff --git a/src/dvd_input.c b/src/dvd_input.c
index e021098..9e6a0de 100644
--- a/src/dvd_input.c
+++ b/src/dvd_input.c
@@ -238,8 +238,9 @@ static int file_read(dvd_input_t dev, void *buffer, int blocks, int flags)
        * Adjust the file position back to the previous block boundary. */
       size_t bytes = (size_t)blocks * DVD_VIDEO_LB_LEN - len;
       off_t over_read = -(bytes % DVD_VIDEO_LB_LEN);
-      /*off_t pos =*/ lseek(dev->fd, over_read, SEEK_CUR);
-      /* should have pos % 2048 == 0 */
+      off_t pos = lseek(dev->fd, over_read, SEEK_CUR);
+      if(pos % 2048 != 0)
+        fprintf( stderr, "libdvdread: lseek not multiple of 2048! Something is wrong!\n" );
       return (int) (bytes / DVD_VIDEO_LB_LEN);
     }
 



More information about the libdvdnav-devel mailing list