diff options
Diffstat (limited to 'src/logic')
-rw-r--r-- | src/logic/sfrt_map_input.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/logic/sfrt_map_input.c b/src/logic/sfrt_map_input.c index abcedab..77cc40e 100644 --- a/src/logic/sfrt_map_input.c +++ b/src/logic/sfrt_map_input.c @@ -7,12 +7,14 @@ #include <sys/stat.h> #include <sofort/sofort.h> +#include "sofort_errinfo_impl.h" int sfrt_map_input( - int fd, - const char * path, - int prot, - struct sfrt_input * map) + const struct sfrt_driver_ctx * dctx, + int fd, + const char * path, + int prot, + struct sfrt_input * map) { struct stat st; bool fnew; @@ -22,13 +24,13 @@ int sfrt_map_input( fd = open(path,O_RDONLY | O_CLOEXEC); if (fd < 0) - return -1; + return SFRT_SYSTEM_ERROR(dctx); if ((ret = fstat(fd,&st) < 0) && fnew) close(fd); if (ret < 0) - return -1; + return SFRT_SYSTEM_ERROR(dctx); map->size = st.st_size; map->addr = mmap(0,map->size,prot,MAP_PRIVATE,fd,0); @@ -36,7 +38,9 @@ int sfrt_map_input( if (fnew) close(fd); - return (map->addr == MAP_FAILED) ? -1 : 0; + return (map->addr == MAP_FAILED) + ? SFRT_SYSTEM_ERROR(dctx) + : 0; } int sfrt_unmap_input(struct sfrt_input * map) |