提交 7f8508e8 编写于 作者: L Linus Torvalds 提交者: Junio C Hamano

Fix double "close()" in ce_compare_data

Doing an "strace" on "git diff" shows that we close() a file descriptor
twice (getting EBADFD on the second one) when we end up in ce_compare_data
if the index does not match the checked-out stat information.

The "index_fd()" function will already have closed the fd for us, so we
should not close it again.
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 b63fafdf
......@@ -61,7 +61,7 @@ static int ce_compare_data(struct cache_entry *ce, struct stat *st)
unsigned char sha1[20];
if (!index_fd(sha1, fd, st, 0, NULL))
match = memcmp(sha1, ce->sha1, 20);
close(fd);
/* index_fd() closed the file descriptor already */
}
return match;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册