[MPlayer-cvslog] r31927 - trunk/stream/stream_bd.c

reimar subversion at mplayerhq.hu
Wed Aug 4 15:49:16 CEST 2010


Author: reimar
Date: Wed Aug  4 15:49:16 2010
New Revision: 31927

Log:
Return an error when seeking beyond EOF.
Avoids an endless loop.

Modified:
   trunk/stream/stream_bd.c

Modified: trunk/stream/stream_bd.c
==============================================================================
--- trunk/stream/stream_bd.c	Wed Aug  4 15:39:10 2010	(r31926)
+++ trunk/stream/stream_bd.c	Wed Aug  4 15:49:16 2010	(r31927)
@@ -107,6 +107,11 @@ static int bd_stream_seek(stream_t *s, o
 
     // must seek to start of unit
     pos -= pos % BD_UNIT_SIZE;
+    if (fseek(bd->title_file, pos, SEEK_SET) < 0) {
+        s->eof = 1;
+        return 0;
+    }
+
     bd->pos = pos;
     s->pos  = pos;
 
@@ -257,8 +262,6 @@ static off_t bd_read(struct bd_priv *bd,
     if (!len)
         return 0;
 
-    fseek(bd->title_file, bd->pos, SEEK_SET);
-
     read_len = fread(buf, 1, len, bd->title_file);
     if (read_len != len)
         return -1;


More information about the MPlayer-cvslog mailing list