mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
file: return proper error on seek failures
This commit is contained in:
parent
2568646abb
commit
4ed5ac50d3
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user