]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/file.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavformat / file.c
index e21148e2b464f0bee4418b055fc89800ef440e52..209957b9d3f2debb825709d02605598cd5810b4c 100644 (file)
@@ -135,12 +135,17 @@ 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;
+    int64_t ret;
+
     if (whence == AVSEEK_SIZE) {
         struct stat st;
-        int ret = fstat(c->fd, &st);
+        ret = fstat(c->fd, &st);
         return ret < 0 ? AVERROR(errno) : (S_ISFIFO(st.st_mode) ? 0 : 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)