diff --git a/drivers/ramdisk.c b/drivers/ramdisk.c index 4473a41ad1..b31e1f0dd9 100644 --- a/drivers/ramdisk.c +++ b/drivers/ramdisk.c @@ -303,7 +303,7 @@ static ssize_t rd_write(FAR struct inode *inode, const unsigned char *buffer, else if (start_sector < dev->rd_nsectors && start_sector + nsectors <= dev->rd_nsectors) { - finfo("Transfer %d bytes from %p\n", + finfo("Transfer %d bytes to %p\n", nsectors * dev->rd_sectsize, &dev->rd_buffer[start_sector * dev->rd_sectsize]); diff --git a/fs/fat/fs_fat32.c b/fs/fat/fs_fat32.c index aa165accfa..e3ad8b166c 100644 --- a/fs/fat/fs_fat32.c +++ b/fs/fat/fs_fat32.c @@ -1786,6 +1786,16 @@ static int fat_truncate(FAR struct file *filep, off_t length) ret = fat_dirshrink(fs, direntry, length); } + + if (ret >= 0) + { + /* The truncation has completed without error. Update the file + * size. + */ + + ff->ff_size = length; + ret = OK; + } } else { @@ -1797,7 +1807,9 @@ static int fat_truncate(FAR struct file *filep, off_t length) ret = fat_dirextend(fs, ff, length); if (ret >= 0) { - /* The truncation has completed without error. Update the file size */ + /* The truncation has completed without error. Update the file + * size. + */ ff->ff_size = length; ret = OK;