diff --git a/builtin-apply.c b/builtin-apply.c
index 8248e09476bafbe07971f6f447ef6677576895bf..58d998577e6d4148ddead9e57bdb0999ff026f73 100644 (file)
--- a/builtin-apply.c
+++ b/builtin-apply.c
stream.avail_in = size;
stream.next_out = out = xmalloc(inflated_size);
stream.avail_out = inflated_size;
- inflateInit(&stream);
- st = inflate(&stream, Z_FINISH);
+ git_inflate_init(&stream);
+ st = git_inflate(&stream, Z_FINISH);
+ git_inflate_end(&stream);
if ((st != Z_STREAM_END) || stream.total_out != inflated_size) {
free(out);
return NULL;
@@ -2435,7 +2436,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)