summaryrefslogtreecommitdiff
path: root/src/unix/map.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-10-27 10:06:58 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2014-10-27 10:06:58 +0100
commitccb1b990b0d105a7a9d7cb4d870d8033c47a69f2 (patch)
treebd5bcbe3c456fccd56d0165873d2dadfddbc69b2 /src/unix/map.c
parent94f74ad28f191e7dc17ae874c00e3ecd6a80fcf4 (diff)
parent62e562f92b45b6a9b124452f7de6b9e86a179224 (diff)
downloadlibgit2-development.tar.gz
Merge pull request #2366 from kitbellew/fix-indexer-mmap-castdevelopment
Fix compiler warning (git_off_t cast to size_t).
Diffstat (limited to 'src/unix/map.c')
-rw-r--r--src/unix/map.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/unix/map.c b/src/unix/map.c
index 3d0cbbaf8..0a235d5a1 100644
--- a/src/unix/map.c
+++ b/src/unix/map.c
@@ -13,9 +13,15 @@
#include <unistd.h>
#include <errno.h>
-long git__page_size(void)
+int git__page_size(size_t *page_size)
{
- return sysconf(_SC_PAGE_SIZE);
+ long sc_page_size = sysconf(_SC_PAGE_SIZE);
+ if (sc_page_size < 0) {
+ giterr_set_str(GITERR_OS, "Can't determine system page size");
+ return -1;
+ }
+ *page_size = (size_t) sc_page_size;
+ return 0;
}
int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset)