aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vis.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/vis.c b/vis.c
index 2cfc40a..87d6cd1 100644
--- a/vis.c
+++ b/vis.c
@@ -1567,7 +1567,8 @@ static bool cmd_read(Filerange *range, const char *argv[]) {
text_insert(vis->win->text, pos, data, info.st_size);
pos += info.st_size;
err:
- close(fd);
+ if (fd != -1)
+ close(fd);
if (data && data != MAP_FAILED)
munmap(data, info.st_size);
}