summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Eric Wong <e@80x24.org>2019-12-26 10:42:19 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-12-26 10:09:35 -0800
commit280738c36ebd19076902796cb07950efc749d89b (patch)
tree30d28af132ed8a41c8af8d5650998a4838711c90
parentGit 2.22.2 (diff)
downloadtgif-280738c36ebd19076902796cb07950efc749d89b.tar.xz
packfile: remove redundant fcntl F_GETFD/F_SETFD
git_open sets close-on-exec since cd66ada06588f797 ("sha1_file: open window into packfiles with O_CLOEXEC"). There's no reason to keep using fcntl to set the close-on-exec flag, anymore. Signed-off-by: Eric Wong <e@80x24.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--packfile.c11
1 files changed, 0 insertions, 11 deletions
diff --git a/packfile.c b/packfile.c
index c0d83fdfed..518d9d5b54 100644
--- a/packfile.c
+++ b/packfile.c
@@ -489,7 +489,6 @@ static int open_packed_git_1(struct packed_git *p)
struct pack_header hdr;
unsigned char hash[GIT_MAX_RAWSZ];
unsigned char *idx_hash;
- long fd_flag;
ssize_t read_result;
const unsigned hashsz = the_hash_algo->rawsz;
@@ -533,16 +532,6 @@ static int open_packed_git_1(struct packed_git *p)
} else if (p->pack_size != st.st_size)
return error("packfile %s size changed", p->pack_name);
- /* We leave these file descriptors open with sliding mmap;
- * there is no point keeping them open across exec(), though.
- */
- fd_flag = fcntl(p->pack_fd, F_GETFD, 0);
- if (fd_flag < 0)
- return error("cannot determine file descriptor flags");
- fd_flag |= FD_CLOEXEC;
- if (fcntl(p->pack_fd, F_SETFD, fd_flag) == -1)
- return error("cannot set FD_CLOEXEC");
-
/* Verify we recognize this pack file format. */
read_result = read_in_full(p->pack_fd, &hdr, sizeof(hdr));
if (read_result < 0)