提交 e1e43898 编写于 作者: J Johannes Schindelin 提交者: Junio C Hamano

apply: fix access to an uninitialized mode variable, found by valgrind

When 'tpatch' was initialized successfully, st_mode was already taken
from the previous diff.  We should not try to override it with data
from an lstat() that was never called.

This is a companion patch to 7a07841c(git-apply: handle a patch that
touches the same path more than once better).
Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 bc395643
......@@ -2445,7 +2445,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s
return error("%s: %s", old_name, strerror(errno));
}
if (!cached)
if (!cached && !tpatch)
st_mode = ce_mode_from_stat(*ce, st->st_mode);
if (patch->is_new < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册