summaryrefslogtreecommitdiff
path: root/lockfile.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2015-08-10 09:47:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-08-10 19:57:14 (GMT)
commite54c347c1c444c0f37b64b8735c50a66ee0527e9 (patch)
tree02d2fc2f4952cf510273ad357afec5efd8c81641 /lockfile.c
parent2db69de81deea4682579d0b9e6da40b4e9558c05 (diff)
downloadgit-e54c347c1c444c0f37b64b8735c50a66ee0527e9.zip
git-e54c347c1c444c0f37b64b8735c50a66ee0527e9.tar.gz
git-e54c347c1c444c0f37b64b8735c50a66ee0527e9.tar.bz2
create_bundle(): duplicate file descriptor to avoid closing it twice
write_pack_data() passes bundle_fd to start_command() to be used as the stdout of pack-objects. But start_command() closes its stdout if it is > 1. This is a problem if bundle_fd is the fd of a lock_file, because commit_lock_file() will also try to close the fd. So the old code suppressed commit_lock_file()'s usual behavior of closing the file descriptor by setting the lock_file object's fd field to -1. But this is not really kosher. Code here shouldn't be mutating fields within the lock_file object. Instead, duplicate the file descriptor before passing it to write_pack_data(). Then that function can close its copy without closing the copy held in the lock_file object. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'lockfile.c')
0 files changed, 0 insertions, 0 deletions