diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-05-09 21:42:24 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-05-09 21:42:24 -0700 |
commit | bcf7eb013fc3e8719229256f40c33ced212dd815 (patch) | |
tree | 3654a72b9bb8e670f8993da39875d284d8ca01d5 | |
parent | 246b02f9e3a7703384f5acf7af7724410bf2ae9b (diff) | |
download | pcu-bcf7eb013fc3e8719229256f40c33ced212dd815.tar.gz |
mincore: fix offset calculations
-rw-r--r-- | mincore.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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) { |