summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e267c2f)
raw | patch | inline | side by side (parent: e267c2f)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Wed, 15 Nov 2006 16:27:54 +0000 (17:27 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 15 Nov 2006 18:23:47 +0000 (10:23 -0800) |
"git-index-pack --fix-thin" relies on mmap() not changing the current
file position (otherwise the pack will be corrupted when writing the
final SHA1). Meet that expectation.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
file position (otherwise the pack will be corrupted when writing the
final SHA1). Meet that expectation.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
compat/mmap.c | patch | blob | history |
diff --git a/compat/mmap.c b/compat/mmap.c
index 55cb120764da5520da7dbd91193a285551eae8bb..a4d2e507f73c5595a2ca76c0369349cc11e2426f 100644 (file)
--- a/compat/mmap.c
+++ b/compat/mmap.c
void *gitfakemmap(void *start, size_t length, int prot , int flags, int fd, off_t offset)
{
int n = 0;
+ off_t current_offset = lseek(fd, 0, SEEK_CUR);
if (start != NULL || !(flags & MAP_PRIVATE))
die("Invalid usage of gitfakemmap.");
n += count;
}
+ if (current_offset != lseek(fd, current_offset, SEEK_SET)) {
+ errno = EINVAL;
+ return MAP_FAILED;
+ }
+
return start;
}