Fixed error check when truncating files to larger size

This commit is contained in:
Christopher Haster
2018-02-04 13:48:44 -06:00
parent 809ffde60f
commit 6716b5580a
2 changed files with 28 additions and 3 deletions

2
lfs.c
View File

@@ -1694,7 +1694,7 @@ int lfs_file_truncate(lfs_t *lfs, lfs_file_t *file, lfs_off_t size) {
// flush+seek if not already at end
if (file->pos != oldsize) {
int err = lfs_file_seek(lfs, file, 0, SEEK_END);
if (err) {
if (err < 0) {
return err;
}
}