diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2015-08-10 11:47:37 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-08-10 12:57:14 -0700 |
commit | e54c347c1c444c0f37b64b8735c50a66ee0527e9 (patch) | |
tree | 02d2fc2f4952cf510273ad357afec5efd8c81641 /lockfile.h | |
parent | 2db69de81deea4682579d0b9e6da40b4e9558c05 (diff) | |
download | git-e54c347c1c444c0f37b64b8735c50a66ee0527e9.tar.gz |
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.h')
0 files changed, 0 insertions, 0 deletions