summaryrefslogtreecommitdiff
path: root/Src/parse.c
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-05-15 08:38:59 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-05-15 08:38:59 +0000
commita2a1c2411a4bae2e1428ca2404458c978f8f5920 (patch)
treef294a84d5a51b3911f8166fa548b7ffbef081c2a /Src/parse.c
parent6f17b7c2e225eacfeba20ba18e3842a1ecf90122 (diff)
downloadzsh-a2a1c2411a4bae2e1428ca2404458c978f8f5920.tar.gz
zsh-a2a1c2411a4bae2e1428ca2404458c978f8f5920.zip
calculate the length of the region to map (for mapped zwc files) correctly, including the offset-page-boundary-adjustment (14346)
Diffstat (limited to 'Src/parse.c')
-rw-r--r--Src/parse.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Src/parse.c b/Src/parse.c
index cf3fe237a..78b14fb41 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -2782,7 +2782,7 @@ load_dump_file(char *dump, struct stat *sbuf, int other, int len)
{
FuncDump d;
Wordcode addr;
- int fd, off;
+ int fd, off, mlen;
if (other) {
static size_t pgsz = 0;
@@ -2802,15 +2802,17 @@ load_dump_file(char *dump, struct stat *sbuf, int other, int len)
pgsz--;
}
off = len & ~pgsz;
- } else
+ mlen = len + (len - off);
+ } else {
off = 0;
-
+ mlen = len;
+ }
if ((fd = open(dump, O_RDONLY)) < 0)
return;
fd = movefd(fd);
- if ((addr = (Wordcode) mmap(NULL, len, PROT_READ, MAP_SHARED, fd, off)) ==
+ if ((addr = (Wordcode) mmap(NULL, mlen, PROT_READ, MAP_SHARED, fd, off)) ==
((Wordcode) -1)) {
close(fd);
return;