summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2017-10-26 01:48:32 -0400
committermidipix <writeonce@midipix.org>2017-10-26 01:48:32 -0400
commit11b667c029b689cf82512519c57b13c9c43ce091 (patch)
treee7e49ee2158444f9a74805cc0b38fb8425cd74bc
parent7999c7b9c6f1806c4c99476651967dfba32673c4 (diff)
downloadmdso-11b667c029b689cf82512519c57b13c9c43ce091.tar.bz2
mdso-11b667c029b689cf82512519c57b13c9c43ce091.tar.xz
driver: mdso_map_input(): support empty symbol definition input files.
-rw-r--r--src/helper/mdso_map_input.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/helper/mdso_map_input.c b/src/helper/mdso_map_input.c
index 77401f3..090de12 100644
--- a/src/helper/mdso_map_input.c
+++ b/src/helper/mdso_map_input.c
@@ -41,9 +41,11 @@ int mdso_map_input(
if (ret < 0)
return MDSO_SYSTEM_ERROR(dctx);
- else if (st.st_size == 0)
- return MDSO_CUSTOM_ERROR(
- dctx,MDSO_ERR_SOURCE_SIZE_ZERO);
+ if (st.st_size == 0) {
+ map->size = 0;
+ map->addr = 0;
+ return 0;
+ }
map->size = st.st_size;
map->addr = mmap(0,map->size,prot,MAP_PRIVATE,fd,0);
@@ -58,5 +60,5 @@ int mdso_map_input(
int mdso_unmap_input(struct mdso_input * map)
{
- return munmap(map->addr,map->size);
+ return map->size ? munmap(map->addr,map->size) : 0;
}