diff options
Diffstat (limited to 'src/export/mystdlib.c')
-rw-r--r-- | src/export/mystdlib.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/export/mystdlib.c b/src/export/mystdlib.c index b65f63d..31c991e 100644 --- a/src/export/mystdlib.c +++ b/src/export/mystdlib.c | |||
@@ -21,7 +21,9 @@ MAP map_file( char *filename, int readonly ) | |||
21 | if( ( map->fh = open( filename, readonly ? O_RDONLY : O_RDWR ) ) >= 0 ) | 21 | if( ( map->fh = open( filename, readonly ? O_RDONLY : O_RDWR ) ) >= 0 ) |
22 | { | 22 | { |
23 | fstat( map->fh, &fstatus ); | 23 | fstat( map->fh, &fstatus ); |
24 | if( ( map->addr = mmap( NULL, map->size = (size_t)fstatus.st_size, | 24 | map->size = (size_t)fstatus.st_size; |
25 | if (!map->size) return map; | ||
26 | if( ( map->addr = mmap( NULL, map->size, | ||
25 | PROT_READ | ( readonly ? 0 : PROT_WRITE), (readonly ? MAP_PRIVATE : MAP_SHARED), map->fh, 0) ) == MAP_FAILED ) | 27 | PROT_READ | ( readonly ? 0 : PROT_WRITE), (readonly ? MAP_PRIVATE : MAP_SHARED), map->fh, 0) ) == MAP_FAILED ) |
26 | { | 28 | { |
27 | fprintf( stderr, "Mapping file '%s' failed\n", filename ); | 29 | fprintf( stderr, "Mapping file '%s' failed\n", filename ); |