diff options
author | Ron Yorston <rmy@tigress.co.uk> | 2013-03-07 20:37:23 +0000 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-03-15 02:10:07 +0100 |
commit | cb5aa725df472a7ab84c7c513a8dda98b9b3a6bc (patch) | |
tree | 08c5b37bc6e78a4aa89dde57d2cf4b4d5ffa67c3 | |
parent | 257a77568ab452244de55d4cd35ba39541fce2a7 (diff) | |
download | busybox-w32-cb5aa725df472a7ab84c7c513a8dda98b9b3a6bc.tar.gz busybox-w32-cb5aa725df472a7ab84c7c513a8dda98b9b3a6bc.tar.bz2 busybox-w32-cb5aa725df472a7ab84c7c513a8dda98b9b3a6bc.zip |
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>
-rw-r--r-- | editors/vi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/editors/vi.c b/editors/vi.c index 7173415c8..3d6182bbf 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -2530,7 +2530,7 @@ static int file_insert(const char *fn, char *p, int update_ro_status) | |||
2530 | p = text_hole_delete(p, p + size - 1); // un-do buffer insert | 2530 | p = text_hole_delete(p, p + size - 1); // un-do buffer insert |
2531 | } else if (cnt < size) { | 2531 | } else if (cnt < size) { |
2532 | // There was a partial read, shrink unused space text[] | 2532 | // There was a partial read, shrink unused space text[] |
2533 | p = text_hole_delete(p + cnt, p + (size - cnt) - 1); // un-do buffer insert | 2533 | p = text_hole_delete(p + cnt, p + size - 1); // un-do buffer insert |
2534 | status_line_bold("can't read '%s'", fn); | 2534 | status_line_bold("can't read '%s'", fn); |
2535 | } | 2535 | } |
2536 | if (cnt >= size) | 2536 | if (cnt >= size) |