tex: truncate the file in ec_write() - neatvi - [fork] simple vi-type editor wi… | |
git clone git://src.adamsgaard.dk/neatvi | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 5d1137c1c1afeb12e4f583660979db5044a77065 | |
parent 587184fefe29e50689e767573d9af112e2824ddd | |
Author: Ali Gholami Rudi <[email protected]> | |
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(-) | |
--- | |
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); |