summaryrefslogtreecommitdiff
path: root/generate-cmdlist.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-03-18 06:30:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-03-19 20:35:15 (GMT)
commit599d2231077bac5950a9e535c001d557719ff213 (patch)
treefb7b8a51debaf8db36a47d780dd950aa26071837 /generate-cmdlist.sh
parent282616c72d1d08a77ca4fe1186cb708c38408d87 (diff)
downloadgit-599d2231077bac5950a9e535c001d557719ff213.zip
git-599d2231077bac5950a9e535c001d557719ff213.tar.gz
git-599d2231077bac5950a9e535c001d557719ff213.tar.bz2
sha1fd_check: die when we cannot open the file
Right now we return a NULL "struct sha1file" if we encounter an error. However, the sole caller (write_idx_file) does not check the return value, and will segfault if we hit this case. One option would be to handle the error in the caller. However, there's really nothing for it to do but die. This code path is hit during "git index-pack --verify"; after we verify the packfile, we check that the ".idx" we would generate from it is byte-wise identical to what is on disk. We hit the error (and segfault) if we can't open the .idx file (a likely cause of this is that somebody else ran "git repack -ad" while we were verifying). Since we can't complete the requested verification, we really have no choice but to die. Furthermore, the rest of the sha1fd_* functions simply die on errors. So if were to open the file successfully, for example, and then hit a read error, sha1write would call die() for us. So pushing the die() down into sha1fd_check keeps the interface consistent. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'generate-cmdlist.sh')
0 files changed, 0 insertions, 0 deletions