From 84192873bf59ccdb97cfd751130f072c258acbe7 Mon Sep 17 00:00:00 2001 From: midipix Date: Mon, 24 Oct 2016 20:41:57 -0400 Subject: pe_map_raw_image(): improved error trace logic. --- src/logic/pe_map_raw_image.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/logic/pe_map_raw_image.c b/src/logic/pe_map_raw_image.c index 4c6ec92..f7f0df3 100644 --- a/src/logic/pe_map_raw_image.c +++ b/src/logic/pe_map_raw_image.c @@ -35,9 +35,15 @@ int pe_map_raw_image( if ((ret = fstat(fd,&st) < 0) && fnew) close(fd); + else if ((st.st_size == 0) && fnew) + close(fd); + if (ret < 0) return PERK_SYSTEM_ERROR(dctx); + else if (st.st_size == 0) + return PERK_CUSTOM_ERROR(dctx,0); + map->size = st.st_size; map->addr = mmap(0,map->size,prot,MAP_PRIVATE,fd,0); -- cgit v1.2.3