mirror of
https://git.busybox.net/busybox.git
synced 2024-11-23 13:43:28 +08:00
vi: fix adjustment of buffer on partial file read
The second argument to text_hole_delete was incorrect: it should be a pointer to the end of the hole. Signed-off-by: Ron Yorston <rmy@tigress.co.uk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
257a77568a
commit
cb5aa725df
@ -2530,7 +2530,7 @@ static int file_insert(const char *fn, char *p, int update_ro_status)
|
||||
p = text_hole_delete(p, p + size - 1); // un-do buffer insert
|
||||
} else if (cnt < size) {
|
||||
// There was a partial read, shrink unused space text[]
|
||||
p = text_hole_delete(p + cnt, p + (size - cnt) - 1); // un-do buffer insert
|
||||
p = text_hole_delete(p + cnt, p + size - 1); // un-do buffer insert
|
||||
status_line_bold("can't read '%s'", fn);
|
||||
}
|
||||
if (cnt >= size)
|
||||
|
Loading…
Reference in New Issue
Block a user