[Toybox] [PATCH] vi: don't keep fd open unnecessarily.

enh enh at google.com
Wed Mar 11 10:10:56 PDT 2020


As soon as mmap() is done, we can close the fd. xmmap() also will exit
rather than return failure so we can remove that check, and fdlength()
will fall back to lseek() so there's no need to have the fallback in vi
itself.

Spotted because the `TT.fd = 0` in linelist_unload() seemed suspicious;
-1 would have been more natural.
---
 toys/pending/vi.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-vi-don-t-keep-fd-open-unnecessarily.patch
Type: text/x-patch
Size: 2119 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20200311/9ffff1a8/attachment-0002.bin>


More information about the Toybox mailing list