vis

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

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

commit 50580ddbbe8d93381f550eebead2c39a7a6f16a9
parent 1fba3c03306d58a38a336d56b555a8c28b7c6fb0
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Wed, 22 Mar 2017 13:07:18 +0100

text: use proper open(2) flags when saving inplace

This was wrongly changed in commit d8f380b33063c8075ff4af4ae71468b9436ec6b9.

Diffstat:
Mtext.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/text.c b/text.c @@ -924,7 +924,7 @@ static bool text_save_begin_inplace(TextSave *ctx) { Text *txt = ctx->txt; struct stat meta = { 0 }; int newfd = -1, saved_errno; - if ((ctx->fd = open(ctx->filename, 0666, S_IRUSR|S_IWUSR)) == -1) + if ((ctx->fd = open(ctx->filename, O_CREAT|O_WRONLY, 0666)) == -1) goto err; if (fstat(ctx->fd, &meta) == -1) goto err;