Module: wine Branch: master Commit: 015f31fd5d11839cf5e8739514af075b11041d8f URL: https://source.winehq.org/git/wine.git/?a=commit;h=015f31fd5d11839cf5e873951... Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Apr 3 15:48:57 2019 +0200 winebuild: Avoid using mmap(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- tools/winebuild/utils.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c index a1cc9aa..d4f8845 100644 --- a/tools/winebuild/utils.c +++ b/tools/winebuild/utils.c @@ -33,9 +33,6 @@ #ifdef HAVE_SYS_STAT_H # include <sys/stat.h> #endif -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif #include "build.h" @@ -540,18 +537,13 @@ void init_input_buffer( const char *file ) { int fd; struct stat st; + unsigned char *buffer; if ((fd = open( file, O_RDONLY | O_BINARY )) == -1) fatal_perror( "Cannot open %s", file ); if ((fstat( fd, &st ) == -1)) fatal_perror( "Cannot stat %s", file ); if (!st.st_size) fatal_error( "%s is an empty file\n", file ); -#ifdef HAVE_MMAP - if ((input_buffer = mmap( NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0 )) == (void*)-1) -#endif - { - unsigned char *buffer = xmalloc( st.st_size ); - if (read( fd, buffer, st.st_size ) != st.st_size) fatal_error( "Cannot read %s\n", file ); - input_buffer = buffer; - } + input_buffer = buffer = xmalloc( st.st_size ); + if (read( fd, buffer, st.st_size ) != st.st_size) fatal_error( "Cannot read %s\n", file ); close( fd ); input_buffer_filename = xstrdup( file ); input_buffer_size = st.st_size;