summaryrefslogtreecommitdiff
path: root/libavformat/file.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2012-09-14 17:01:35 +0200
committerLuca Barbato <lu_zero@gentoo.org>2012-09-16 15:37:14 +0200
commit4ed5ac50d3e4f921003ecf60985f78337400f354 (patch)
tree207bb9074ad79812a4beeb8e30330ef713ff8f85 /libavformat/file.c
parent2568646abb6568b1d329f800a046832adc48acd4 (diff)
file: return proper error on seek failures
Diffstat (limited to 'libavformat/file.c')
-rw-r--r--libavformat/file.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavformat/file.c b/libavformat/file.c
index 3ea681fd9f..fc0af92277 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)