tex: truncate the file in ec_write() - neatvi - [fork] simple vi-type editor with UTF-8 support
(HTM) git clone git://src.adamsgaard.dk/neatvi
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit 5d1137c1c1afeb12e4f583660979db5044a77065
(DIR) parent 587184fefe29e50689e767573d9af112e2824ddd
(HTM) Author: Ali Gholami Rudi <ali@rudi.ir>
Date: Wed, 6 May 2015 10:35:36 +0430
ex: truncate the file in ec_write()
Diffstat:
M ex.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
(DIR) diff --git a/ex.c b/ex.c
t@@ -222,7 +222,7 @@ static void ec_write(char *ec)
beg = 0;
end = lbuf_len(xb);
}
- fd = open(path, O_WRONLY | O_CREAT, 0600);
+ fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd >= 0) {
lbuf_wr(xb, fd, beg, end);
close(fd);