summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/logic/mdso_map_input.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/logic/mdso_map_input.c b/src/logic/mdso_map_input.c
index 0cb290d..1a766ee 100644
--- a/src/logic/mdso_map_input.c
+++ b/src/logic/mdso_map_input.c
@@ -35,9 +35,15 @@ int mdso_map_input(
if ((ret = fstat(fd,&st) < 0) && fnew)
close(fd);
+ else if ((st.st_size == 0) && fnew)
+ close(fd);
+
if (ret < 0)
return MDSO_SYSTEM_ERROR(dctx);
+ else if (st.st_size == 0)
+ return MDSO_SYSTEM_ERROR(dctx);
+
map->size = st.st_size;
map->addr = mmap(0,map->size,prot,MAP_PRIVATE,fd,0);