summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2021-05-13 08:35:49 +0000
committermidipix <writeonce@midipix.org>2021-05-13 08:35:49 +0000
commit682a4c468d4cf85e8d43fa7b81d6c527321f1812 (patch)
treebcf436cf8c040ea11ce60f4adf6536fea3d70667
parent8ee4f12b00c0922e65ce04721d38968f81c18164 (diff)
downloadmdso-682a4c468d4cf85e8d43fa7b81d6c527321f1812.tar.bz2
mdso-682a4c468d4cf85e8d43fa7b81d6c527321f1812.tar.xz
mdso_map_input(): close the newly opened fd with an empty input file.
-rw-r--r--src/helper/mdso_map_input.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/helper/mdso_map_input.c b/src/helper/mdso_map_input.c
index ab4607f..b7a2677 100644
--- a/src/helper/mdso_map_input.c
+++ b/src/helper/mdso_map_input.c
@@ -48,12 +48,11 @@ int mdso_map_input(
if (st.st_size == 0) {
map->size = 0;
map->addr = 0;
- return 0;
+ } else {
+ map->size = st.st_size;
+ map->addr = mmap(0,map->size,prot,MAP_PRIVATE,fd,0);
}
- map->size = st.st_size;
- map->addr = mmap(0,map->size,prot,MAP_PRIVATE,fd,0);
-
if (fnew)
close(fd);