[FFmpeg-cvslog] file: return proper error on seek failures

Luca Barbato git at videolan.org
Mon Sep 17 15:21:35 CEST 2012


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Fri Sep 14 17:01:35 2012 +0200| [4ed5ac50d3e4f921003ecf60985f78337400f354] | committer: Luca Barbato

file: return proper error on seek failures

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4ed5ac50d3e4f921003ecf60985f78337400f354
---

 libavformat/file.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavformat/file.c b/libavformat/file.c
index 3ea681f..fc0af92 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -121,12 +121,18 @@ static int file_open(URLContext *h, const char *filename, int flags)
 static int64_t file_seek(URLContext *h, int64_t pos, int whence)
 {
     FileContext *c = h->priv_data;
+    int ret;
+
     if (whence == AVSEEK_SIZE) {
         struct stat st;
-        int ret = fstat(c->fd, &st);
+
+        ret = fstat(c->fd, &st);
         return ret < 0 ? AVERROR(errno) : st.st_size;
     }
-    return lseek(c->fd, pos, whence);
+
+    ret = lseek(c->fd, pos, whence);
+
+    return ret < 0 ? AVERROR(errno) : ret;
 }
 
 static int file_close(URLContext *h)



More information about the ffmpeg-cvslog mailing list