summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Heath <doogie@debian.org>2001-04-23 00:03:06 +0000
committerAdam Heath <doogie@debian.org>2001-04-23 00:03:06 +0000
commitf23385c3cbc7638d83faf1a3f7d33fe387e9b005 (patch)
treee018b8cb85d7aecf173bbe751dc26c3b33453377
parentc6a23874c69b81c2fa217d8d762ce095f5e4438c (diff)
downloaddpkg-f23385c3cbc7638d83faf1a3f7d33fe387e9b005.tar.gz
s/PARSE_MMAP/HAVE_MMAP/, so that we now use mmap to read status and
available(and like files).
-rw-r--r--ChangeLog5
-rw-r--r--lib/parse.c11
2 files changed, 11 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 2a3a1c0f3..8ce924f22 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Apr 22 19:02:12 CDT 2001 Adam Heath <doogie@debian.org>
+
+ * lib/parse.c: s/PARSE_MMAP/HAVE_MMAP/, so that we now use mmap
+ to read status and available(and like files).
+
Sun Apr 22 18:32:02 CDT 2001 Adam Heath <doogie@debian.org>
* lib/parse.c: Fix another segfault when parsing single-paragraph
diff --git a/lib/parse.c b/lib/parse.c
index 646794dc8..15525523d 100644
--- a/lib/parse.c
+++ b/lib/parse.c
@@ -29,15 +29,16 @@
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
-#ifdef PARSE_MMAP
-#include <sys/mman.h>
-#endif
#include <config.h>
#include <dpkg.h>
#include <dpkg-db.h>
#include "parsedump.h"
+#ifdef HAVE_MMAP
+#include <sys/mman.h>
+#endif
+
const struct fieldinfo fieldinfos[]= {
/* NB: capitalisation of these strings is important. */
{ "Package", f_name, w_name },
@@ -108,7 +109,7 @@ int parsedb(const char *filename, enum parsedbflags flags,
if (fstat(fd, &stat) == -1)
ohshite(_("can't stat package info file `%.255s'"),filename);
-#ifdef PARSE_MMAP
+#ifdef HAVE_MMAP
if ((dataptr= (char *)mmap(NULL, stat.st_size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED)
ohshite(_("can't mmap package info file `%.255s'"),filename);
#else
@@ -316,7 +317,7 @@ int parsedb(const char *filename, enum parsedbflags flags,
if (c == '\n') lno++;
}
pop_cleanup(0);
-#ifdef PARSE_MMAP
+#ifdef HAVE_MMAP
munmap(data, stat.st_size);
#else
free(data);