From bcf7eb013fc3e8719229256f40c33ced212dd815 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 9 May 2009 21:42:24 -0700 Subject: mincore: fix offset calculations --- mincore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mincore.c b/mincore.c index ff0edc3..0379481 100644 --- a/mincore.c +++ b/mincore.c @@ -25,7 +25,7 @@ static void mincore_stats(const char *path, off_t offset, off_t len) path, fd, strerror(errno)); goto err_close; } - len = sb.st_size; + len = sb.st_size - offset; } vec_len = (len + page_size() - 1) / page_size(); @@ -36,7 +36,7 @@ static void mincore_stats(const char *path, off_t offset, off_t len) } map_len = PAGE_ALIGN(len); - map_offset = PAGE_ALIGN_DOWN(offset); + map_offset = PAGE_ALIGN_DOWN(offset + 1); map = mmap(NULL, map_len, PROT_READ, MAP_SHARED, fd, map_offset); if (!map) { -- cgit v1.2.3-24-ge0c7