Fix lseek() return value handling

lseek() returns an off_t and not an int, using an int to store and
test the return value means we'll error out when the position in the file
gets past INT_MAX.
This commit is contained in:
Julien BLACHE
2010-02-10 18:19:32 +01:00
parent 2b4f07195a
commit a5a46b8a53
2 changed files with 6 additions and 4 deletions

View File

@@ -313,6 +313,7 @@ struct transcode_ctx *
transcode_setup(struct media_file_info *mfi, off_t *est_size)
{
struct transcode_ctx *ctx;
off_t pos;
int hdr_len;
int i;
int ret;
@@ -428,8 +429,8 @@ transcode_setup(struct media_file_info *mfi, off_t *est_size)
else
hdr_len = 0;
ret = lseek(ctx->fd, hdr_len, SEEK_SET);
if (ret < 0)
pos = lseek(ctx->fd, hdr_len, SEEK_SET);
if (pos == (off_t) -1)
{
DPRINTF(E_WARN, L_XCODE, "Could not seek: %s\n", strerror(errno));