diff --git a/formats/format_pcm.c b/formats/format_pcm.c index 87363239d..1de3d166f 100644 --- a/formats/format_pcm.c +++ b/formats/format_pcm.c @@ -179,7 +179,8 @@ static int pcm_seek(struct ast_filestream *fs, long sample_offset, int whence) long cur, max, offset; cur = ftell(fs->f); - max = fseek(fs->f, 0, SEEK_END); + fseek(fs->f, 0, SEEK_END); + max = ftell(fs->f); switch (whence) { case SEEK_SET: diff --git a/formats/format_pcm_alaw.c b/formats/format_pcm_alaw.c index b26796bda..a738cf07b 100644 --- a/formats/format_pcm_alaw.c +++ b/formats/format_pcm_alaw.c @@ -254,7 +254,8 @@ static int pcm_seek(struct ast_filestream *fs, long sample_offset, int whence) long cur, max, offset; cur = ftell(fs->f); - max = fseek(fs->f, 0, SEEK_END); + fseek(fs->f, 0, SEEK_END); + max = ftell(fs->f); switch (whence) { case SEEK_SET: