summaryrefslogtreecommitdiffhomepage
path: root/src/logic
diff options
context:
space:
mode:
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/amgc_map_input.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/logic/amgc_map_input.c b/src/logic/amgc_map_input.c
index b4e07ea..c0d4a2b 100644
--- a/src/logic/amgc_map_input.c
+++ b/src/logic/amgc_map_input.c
@@ -35,9 +35,16 @@ int amgc_map_input(
if ((ret = fstat(fd,&st) < 0) && fnew)
close(fd);
+ else if ((st.st_size == 0) && fnew)
+ close(fd);
+
if (ret < 0)
return AMGC_SYSTEM_ERROR(dctx);
+ else if (st.st_size == 0)
+ return AMGC_CUSTOM_ERROR(
+ dctx,AMGC_ERR_SOURCE_SIZE_ZERO);
+
map->size = st.st_size;
map->addr = mmap(0,map->size,prot,MAP_PRIVATE,fd,0);