From 015f31fd5d11839cf5e8739514af075b11041d8f Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 3 Apr 2019 15:48:57 +0200 Subject: [PATCH] winebuild: Avoid using mmap(). Signed-off-by: Alexandre Julliard --- 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 a1cc9aabd41..d4f88457983 100644 --- a/tools/winebuild/utils.c +++ b/tools/winebuild/utils.c @@ -33,9 +33,6 @@ #ifdef HAVE_SYS_STAT_H # include #endif -#ifdef HAVE_SYS_MMAN_H -#include -#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;