summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-12-08 23:11:20 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-12-08 23:11:20 (GMT)
commiteae47db8657199518b0785db6d83cf9fec179b47 (patch)
treec09f513ef57e9d642d61c4c2fd76edba08f706f6
parent8e2def76f76cdf531034d13170e317afeb100d23 (diff)
parent6031af387e7d0554d3202e0039d9d9af1691a6a4 (diff)
downloadgit-eae47db8657199518b0785db6d83cf9fec179b47.zip
git-eae47db8657199518b0785db6d83cf9fec179b47.tar.gz
git-eae47db8657199518b0785db6d83cf9fec179b47.tar.bz2
Merge branch 'rs/fetch-pack-invalid-lockfile'
"fetch-pack" could pass NULL pointer to unlink(2) when it sees an invalid filename; the error checking has been tightened to make this impossible. * rs/fetch-pack-invalid-lockfile: fetch-pack: disregard invalid pack lockfiles
-rw-r--r--fetch-pack.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index 23179b8..876f90c 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -918,8 +918,9 @@ static int get_pack(struct fetch_pack_args *args,
if (start_command(&cmd))
die(_("fetch-pack: unable to fork off %s"), cmd_name);
if (do_keep && pack_lockfiles) {
- string_list_append_nodup(pack_lockfiles,
- index_pack_lockfile(cmd.out));
+ char *pack_lockfile = index_pack_lockfile(cmd.out);
+ if (pack_lockfile)
+ string_list_append_nodup(pack_lockfiles, pack_lockfile);
close(cmd.out);
}