From 69e9a586ba828e0c1bab543ee24e5f562dcb2870 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Mon, 2 Jul 2007 21:24:11 +0300 Subject: [PATCH] Bug 960: Redefine LOADMSGCAT_USE_MMAP instead of HAVE_MMAP. And add a prominent notice as stipulated in GNU GPL version 2 section 2a. [ From commit ba54124f169a1c8506a11437d01c77c382bbe161 in ELinks 0.11.3.GIT. --KON ] --- src/intl/gettext/loadmsgcat.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/intl/gettext/loadmsgcat.c b/src/intl/gettext/loadmsgcat.c index faa2f9165..0eac28316 100644 --- a/src/intl/gettext/loadmsgcat.c +++ b/src/intl/gettext/loadmsgcat.c @@ -15,6 +15,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* Modified on 2007-07-02 by Kalle Olavi Niemitalo. */ + /* Tell glibc's to provide a prototype for mempcpy(). This must come before because may include , and once has been included, it's too late. */ @@ -41,10 +43,15 @@ #if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) #include -#undef HAVE_MMAP -#define HAVE_MMAP 1 +/* Use a custom macro instead of overloading HAVE_MMAP, because the + * following #include directives may cause "config.h" to be included + * again (bug 960). It might be good to remove #include "config.h" + * directives from header files and keep them in *.c files only, but + * that seems too risky for the stable elinks-0.11 branch. */ +#undef LOADMSGCAT_USE_MMAP +#define LOADMSGCAT_USE_MMAP 1 #else -#undef HAVE_MMAP +#undef LOADMSGCAT_USE_MMAP #endif #include "elinks.h" @@ -285,7 +292,7 @@ source_success: close(fd); return; } -#ifdef HAVE_MMAP +#ifdef LOADMSGCAT_USE_MMAP /* Now we are ready to load the file. If mmap() is available we try this first. If not available or it failed we try to load it. */ data = (struct mo_file_header *) mmap(NULL, size, PROT_READ, @@ -328,7 +335,7 @@ source_success: catalog file. */ if (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED) { /* The magic number is wrong: not a message catalog file. */ -#ifdef HAVE_MMAP +#ifdef LOADMSGCAT_USE_MMAP if (use_mmap) munmap((void *) data, size); else @@ -365,7 +372,7 @@ source_success: break; default: /* This is an invalid revision. */ -#ifdef HAVE_MMAP +#ifdef LOADMSGCAT_USE_MMAP if (use_mmap) munmap((void *) data, size); else