proper error handling in file size retrieval, patch by Ronald S. Bultje rbultje at...
authorRonald S. Bultje <rsbultje@gmail.com>
Sun, 28 Jan 2007 02:38:02 +0000 (02:38 +0000)
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>
Sun, 28 Jan 2007 02:38:02 +0000 (02:38 +0000)
Originally committed as revision 7736 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/aviobuf.c

index 4a595e2..ab8fc1d 100644 (file)
@@ -172,7 +172,9 @@ offset_t url_fsize(ByteIOContext *s)
         return -EPIPE;
     size = s->seek(s->opaque, 0, AVSEEK_SIZE);
     if(size<0){
         return -EPIPE;
     size = s->seek(s->opaque, 0, AVSEEK_SIZE);
     if(size<0){
-        size = s->seek(s->opaque, -1, SEEK_END) + 1;
+        if ((size = s->seek(s->opaque, -1, SEEK_END)) < 0)
+            return size;
+        size++;
         s->seek(s->opaque, s->pos, SEEK_SET);
     }
     return size;
         s->seek(s->opaque, s->pos, SEEK_SET);
     }
     return size;