about summary refs log tree commit homepage
path: root/mincore.c
diff options
context:
space:
mode:
Diffstat (limited to 'mincore.c')
-rw-r--r--mincore.c4
1 files 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) {