aboutsummaryrefslogtreecommitdiff
path: root/text.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-01-16 11:10:56 +0100
committerMarc André Tanner <mat@brain-dump.org>2015-01-16 11:10:56 +0100
commit02187686c26b3e08245a41636df7ee4da595906f (patch)
treec7f9717da6ac34bbb325dfc36d414f3a97d61d20 /text.c
parent931cf0ed8ebcfc9a1c43055873a31f3c1293d012 (diff)
downloadvis-02187686c26b3e08245a41636df7ee4da595906f.tar.gz
vis-02187686c26b3e08245a41636df7ee4da595906f.tar.xz
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 (limited to 'text.c')
-rw-r--r--text.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/text.c b/text.c
index 7ffe064..28003b2 100644
--- 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;