This callback is implemented as a simple wrapper for the ftruncate()
system call, which can fail for a number of reasons. Currently the
callback returns unsigned and the return value is ignored. Fortunately,
this is easy to fix.
return write(fd, dest, count);
}
-static uint32_t aac_afh_meta_truncate_cb(void *user_data)
+static int aac_afh_meta_truncate_cb(void *user_data)
{
int fd = *(int *)user_data;
off_t offset = lseek(fd, 0, SEEK_CUR);
ret = write_data(f, new_moov_data, new_moov_size);
if (ret < 0)
goto free_moov;
- f->cb->truncate(f->cb->user_data);
- ret = 1;
+ ret = f->cb->truncate(f->cb->user_data);
+ if (ret < 0)
+ ret = -ERRNO_TO_PARA_ERROR(errno);
free_moov:
free(new_moov_data);
return ret;
ssize_t (*read)(void *user_data, void *buffer, size_t length);
ssize_t (*write)(void *user_data, void *buffer, size_t count);
off_t (*seek)(void *user_data, off_t offset, int whence);
- uint32_t (*truncate)(void *user_data);
+ int (*truncate)(void *user_data);
void *user_data;
};