From d3a93bfdd33107dea491ffdf5e55b34eebae475a Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Tue, 14 Sep 2010 04:15:17 +0200 Subject: Fix in-memory mapping * exec/exec.c (map): When e->file_data is not NULL, return it plus `posn'. (prepare_in_memory): Call prepare_stream to clear stream positions. --- exec/exec.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'exec/exec.c') diff --git a/exec/exec.c b/exec/exec.c index 272b7899..9273a4cb 100644 --- a/exec/exec.c +++ b/exec/exec.c @@ -443,7 +443,9 @@ map (struct execdata *e, off_t posn, size_t len) else if (posn + len > size) /* The requested data wouldn't fit in the file. */ return NULL; - else if (e->filemap == MACH_PORT_NULL) + else if (e->file_data != NULL) { + return e->file_data + posn; + } else if (e->filemap == MACH_PORT_NULL) { /* No mapping for the file. Read the data by RPC. */ char *buffer = map_buffer (e); @@ -519,7 +521,10 @@ prepare_stream (struct execdata *e) e->map_filepos = 0; } -static void prepare_in_memory (struct execdata *e) {} +static void prepare_in_memory (struct execdata *e) +{ + prepare_stream(e); +} #else -- cgit v1.2.3