summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-10-24 00:13:56 -0400
committermidipix <writeonce@midipix.org>2016-11-11 00:22:49 -0500
commit9384b996730da68f8588b53652e040e68cf216b9 (patch)
tree6ab30d92b0fc0eaa4a4478eacf81ec89744efdb7 /src
parent63e310c13e8a82f429c98c27211639db09c18775 (diff)
downloadmdso-9384b996730da68f8588b53652e040e68cf216b9.tar.bz2
mdso-9384b996730da68f8588b53652e040e68cf216b9.tar.xz
mdso_map_input(): improved error trace logic.
Diffstat (limited to 'src')
-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);