Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/amiga
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2012-09-12 01:05:24 +0400
committerVicent Marti <tanoku@gmail.com>2012-09-12 01:05:24 +0400
commitc859184bb459d9801a394dc44f5b0b0e55453263 (patch)
tree33039b8911dbcba39e9270b73ee152956444f43d /src/amiga
parent1f35e89dbf6e0be8952cc4324a45fd600be5ca05 (diff)
Properly handle p_reads
Diffstat (limited to 'src/amiga')
-rwxr-xr-xsrc/amiga/map.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/amiga/map.c b/src/amiga/map.c
index 2fb065c8b..c601de724 100755
--- a/src/amiga/map.c
+++ b/src/amiga/map.c
@@ -24,18 +24,15 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
return -1;
}
- if((out->data = malloc(len))) {
- p_lseek(fd, offset, SEEK_SET);
- p_read(fd, out->data, len);
- }
+ out->data = malloc(len);
+ GITERR_CHECK_ALLOC(out->data);
- if (!out->data || (out->data == MAP_FAILED)) {
- giterr_set(GITERR_OS, "Failed to mmap. Could not write data");
+ if (p_lseek(fd, offset, SEEK_SET) < 0 || p_read(fd, out->data, len) != len)
+ giterr_set(GITERR_OS, "mmap emulation failed");
return -1;
}
out->len = len;
-
return 0;
}