ref: 562d1ccf077427d1bdcde77eeb1eaddaba2a60b2
parent: c48f9501523bb4521df8f21629ac7be4b3a0a9f8
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Feb 27 10:08:34 EST 2021
ramfs: fix truncfile() for non multiple of extend size (64k) The calculation of the last block size is wrong and we can only shrink the size of the last data block, not extend it.
--- a/sys/src/cmd/ramfs.c
+++ b/sys/src/cmd/ramfs.c
@@ -249,7 +249,8 @@
if(i < n){
o = l % ESIZE;
if(o != 0 && x->ent[i] != nil){
- x->ent[i]->size = o * sizeof(Ram*);
+ if(o < x->ent[i]->size)
+ x->ent[i]->size = o;
i++;
}
while(i < n){
--
⑨