diff options
-rw-r--r-- | src/mystdlib.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mystdlib.c b/src/mystdlib.c index 9d73293..17f123b 100644 --- a/src/mystdlib.c +++ b/src/mystdlib.c | |||
@@ -4,6 +4,8 @@ | |||
4 | #include <unistd.h> | 4 | #include <unistd.h> |
5 | #include <fcntl.h> | 5 | #include <fcntl.h> |
6 | #include <stdio.h> | 6 | #include <stdio.h> |
7 | #include <string.h> | ||
8 | #include <stdlib.h> | ||
7 | 9 | ||
8 | #include "mystdlib.h" | 10 | #include "mystdlib.h" |
9 | 11 | ||
@@ -20,7 +22,7 @@ MAP map_file( char *filename, int readonly ) | |||
20 | { | 22 | { |
21 | fstat( map->fh, &fstatus ); | 23 | fstat( map->fh, &fstatus ); |
22 | if( ( map->addr = mmap( NULL, map->size = (size_t)fstatus.st_size, | 24 | if( ( map->addr = mmap( NULL, map->size = (size_t)fstatus.st_size, |
23 | PROT_READ | ( readonly ? 0 : PROT_WRITE), (readonly ? 0 : MAP_SHARED), map->fh, 0) ) == MAP_FAILED ) | 25 | PROT_READ | ( readonly ? 0 : PROT_WRITE), (readonly ? MAP_PRIVATE : MAP_SHARED), map->fh, 0) ) == MAP_FAILED ) |
24 | { | 26 | { |
25 | fprintf( stderr, "Mapping file '%s' failed\n", filename ); | 27 | fprintf( stderr, "Mapping file '%s' failed\n", filename ); |
26 | close( map->fh ); free( map ); map = NULL; | 28 | close( map->fh ); free( map ); map = NULL; |