aboutsummaryrefslogtreecommitdiff
path: root/src/common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.cpp')
-rw-r--r--src/common.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/common.cpp b/src/common.cpp
index d608a22..8442bf6 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -3,6 +3,7 @@
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
+#include <unistd.h>
line_view load_file(const char* path) {
int fd;
@@ -16,6 +17,7 @@ line_view load_file(const char* path) {
line_view lv;
lv.length = fs.st_size;
lv.line = static_cast<const char*>(mmap(NULL, lv.length, PROT_READ, MAP_PRIVATE, fd, 0));
+ close(fd);
return lv;
}