summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2014-01-11 20:37:11 +0100
committerDirk Engling <erdgeist@erdgeist.org>2014-01-11 20:37:11 +0100
commita5e0e84b98553c3198b6d78a095e96baa57e1fed (patch)
treea4b0b187cc8b8de8c2c51302cd051f8c7f63c6d9
parentfee745afb8def443e3b59422bd57a4e7f1c2437f (diff)
mappings must now be either PRIVATE or SHARED, but not 0 anymore
-rw-r--r--src/mystdlib.c4
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;