summaryrefslogtreecommitdiff
path: root/src/fileops.c
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-03-16 15:56:01 -0700
committerRussell Belfer <arrbee@arrbee.com>2012-03-16 15:56:01 -0700
commit0d0fa7c3681e4ef3d0452666a9bc97d4b08391c9 (patch)
tree5e03e03bf9dc2f6125f4fb450cd3239d882b824f /src/fileops.c
parent4cfe2ab60b1e26554b2bf753b06f538cb3475bd0 (diff)
downloadlibgit2-0d0fa7c3681e4ef3d0452666a9bc97d4b08391c9.tar.gz
Convert attr, ignore, mwindow, status to new errors
Also cleaned up some previously converted code that still had little things to polish.
Diffstat (limited to 'src/fileops.c')
-rw-r--r--src/fileops.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/fileops.c b/src/fileops.c
index aa52b09d7..65942adf5 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -208,13 +208,19 @@ int git_futils_mmap_ro(git_map *out, git_file fd, git_off_t begin, size_t len)
int git_futils_mmap_ro_file(git_map *out, const char *path)
{
- git_file fd = p_open(path, O_RDONLY /* | O_NOATIME */);
- git_off_t len = git_futils_filesize(fd);
+ git_file fd = git_futils_open_ro(path);
+ git_off_t len;
int result;
+
+ if (fd < 0)
+ return fd;
+
+ len = git_futils_filesize(fd);
if (!git__is_sizet(len)) {
giterr_set(GITERR_OS, "File `%s` too large to mmap", path);
return -1;
}
+
result = git_futils_mmap_ro(out, fd, 0, (size_t)len);
p_close(fd);
return result;