diff options
author | midipix <writeonce@midipix.org> | 2016-10-25 23:01:59 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-10-25 23:01:59 -0400 |
commit | deb77f01ce96ff9b46cd8706fabd6ee6b6b17f22 (patch) | |
tree | e75d0038d97065f69b3d5db6cfe570a50edde65c | |
parent | 47a21b92c285ac4d5f4b1b9faf757311269725fd (diff) | |
download | sofort-deb77f01ce96ff9b46cd8706fabd6ee6b6b17f22.tar.bz2 sofort-deb77f01ce96ff9b46cd8706fabd6ee6b6b17f22.tar.xz |
sfrt_map_input(): improved error trace support.
-rw-r--r-- | src/logic/sfrt_map_input.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/logic/sfrt_map_input.c b/src/logic/sfrt_map_input.c index 77cc40e..d73ace6 100644 --- a/src/logic/sfrt_map_input.c +++ b/src/logic/sfrt_map_input.c @@ -29,9 +29,16 @@ int sfrt_map_input( if ((ret = fstat(fd,&st) < 0) && fnew) close(fd); + else if ((st.st_size == 0) && fnew) + close(fd); + if (ret < 0) return SFRT_SYSTEM_ERROR(dctx); + else if (st.st_size == 0) + return SFRT_CUSTOM_ERROR( + dctx,SFRT_ERR_SOURCE_SIZE_ZERO); + map->size = st.st_size; map->addr = mmap(0,map->size,prot,MAP_PRIVATE,fd,0); |