vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit a1104b79f16ff07674ae189c05de1fff54917b9a
parent 8cd7492d336548173dcb4e84e2c3b05cc48af660
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Fri, 16 Jan 2015 11:10:56 +0100

Avoid possible double close when saving

We want close(2) to happen before rename(2).

At some point the save implementation will have to be overhauled.

Diffstat:
Mtext.c | 1+
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/text.c b/text.c @@ -644,6 +644,7 @@ bool text_range_save(Text *txt, Filerange *range, const char *filename) { } if (close(fd) == -1) goto err; + fd = -1; if (rename(tmpname, filename) == -1) goto err; txt->saved_action = txt->undo;