projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Teach git push .git/branches shorthand
[git.git]
/
read-cache.c
diff --git
a/read-cache.c
b/read-cache.c
index
f448ab1
..
5820f18
100644
(file)
--- a/
read-cache.c
+++ b/
read-cache.c
@@
-392,7
+392,7
@@
int read_cache(void)
return (errno == ENOENT) ? 0 : error("open failed");
size = 0; // avoid gcc warning
return (errno == ENOENT) ? 0 : error("open failed");
size = 0; // avoid gcc warning
- map =
(void *)-1
;
+ map =
MAP_FAILED
;
if (!fstat(fd, &st)) {
size = st.st_size;
errno = EINVAL;
if (!fstat(fd, &st)) {
size = st.st_size;
errno = EINVAL;
@@
-400,7
+400,7
@@
int read_cache(void)
map = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
}
close(fd);
map = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
}
close(fd);
- if (
-1 == (int)(long)map
)
+ if (
map == MAP_FAILED
)
return error("mmap failed");
hdr = map;
return error("mmap failed");
hdr = map;