jim

Simple, lightweight, modal, vim-inspired text editor
git clone git://git.janpasierb.com/jim.git
Log | Files | Refs | README | LICENSE

commit 35908c0abb025d46c67d409499956f5e8c778c59
parent 5792153dbb8c6f871ca8284ab13aaa2b3cb7ba52
Author: Jan P. Pasierb <me@janpasierb.com>
Date:   Sat, 23 Dec 2023 17:04:46 +0000

file descriptor now properly closed if file has been successfully created

Diffstat:
Mfile.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/file.c b/file.c @@ -53,8 +53,10 @@ void editorOpen(char* filename) { free(line); fclose(fp); } else { - if(-1 == open(E.filename, O_RDONLY | O_CREAT, 0644)) + int fd = open(E.filename, O_RDONLY | O_CREAT, 0644) + if(fd == -1) die("fopen"); + close(fd); } E.dirty = 0;