Tuesday, July 01, 2025

Re: BSD vi truncates files after internal error

On Tue, 1 Jul 2025, at 15:21, Daniel Boland wrote:
> Hello friends of OpenBSD,
>
> I have been porting OpenBSD to MS Windows. If I use BSD vi to edit and save a file, vi throws an error because the write() system call is failing (EAGAIN), and leaves me with a truncated file.

On BSD, write(2) only returns EAGAIN for files opened in non-blocking mode.
vi most likely opens files in blocking mode, so this error is unreachable.

See: https://man.openbsd.org/write.2#EAGAIN

No comments:

Post a Comment