diff options
| author | Jakob Pfender <jpfender@elegosoft.com> | 2011-05-19 15:29:22 +0200 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2011-05-23 21:38:41 +0300 |
| commit | 450ac186f905a9c821671147bb2cb8ee8b08ac26 (patch) | |
| tree | 4c6e6ccced4ba9c59a2039b1dd54407dca460b2d /src/unix | |
| parent | 57435a6dffbda3ae4966e889ad774b3879d8ae61 (diff) | |
| download | libgit2-450ac186f905a9c821671147bb2cb8ee8b08ac26.tar.gz | |
unix/map.c: Move to new error handling mechanism
Diffstat (limited to 'src/unix')
| -rw-r--r-- | src/unix/map.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/unix/map.c b/src/unix/map.c index 4780bd23c..9bc6178ed 100644 --- a/src/unix/map.c +++ b/src/unix/map.c @@ -13,7 +13,7 @@ int git__mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t o if ((out == NULL) || (len == 0)) { errno = EINVAL; - return GIT_ERROR; + return git__throw(GIT_ERROR, "Failed to mmap. No map or zero length"); } out->data = NULL; @@ -25,7 +25,7 @@ int git__mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t o mprot = PROT_READ; else { errno = EINVAL; - return GIT_ERROR; + return git__throw(GIT_ERROR, "Failed to mmap. Invalid protection parameters"); } if ((flags & GIT_MAP_TYPE) == GIT_MAP_SHARED) @@ -35,12 +35,12 @@ int git__mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t o if (flags & GIT_MAP_FIXED) { errno = EINVAL; - return GIT_ERROR; + return git__throw(GIT_ERROR, "Failed to mmap. FIXED not set"); } out->data = mmap(NULL, len, mprot, mflag, fd, offset); if (!out->data || out->data == MAP_FAILED) - return GIT_EOSERR; + return git__throw(GIT_EOSERR, "Failed to mmap. Could not write data"); out->len = len; return GIT_SUCCESS; @@ -51,7 +51,7 @@ int git__munmap(git_map *map) assert(map != NULL); if (!map) - return GIT_ERROR; + return git__throw(GIT_ERROR, "Failed to munmap. Map does not exist"); munmap(map->data, map->len); |
