@matheusbsbs / matheus-bagliano / commits / 280738c36e
Fork 0

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>

Eric Wong committed Dec 26, 2019 at 10:42 UTC 280738c36ebd19076902796cb07950efc749d89b
1 file changed -11
packfile.c
-11
@@ -489,7 +489,6 @@ static int open_packed_git_1(struct packed_git *p)
489 struct pack_header hdr;
490 unsigned char hash[GIT_MAX_RAWSZ];
491 unsigned char *idx_hash;
492 - long fd_flag;
492 ssize_t read_result;
493 const unsigned hashsz = the_hash_algo->rawsz;
494
@@ -533,16 +532,6 @@ static int open_packed_git_1(struct packed_git *p)
532 } else if (p->pack_size != st.st_size)
533 return error("packfile %s size changed", p->pack_name);
534
536 - /* We leave these file descriptors open with sliding mmap;
537 - * there is no point keeping them open across exec(), though.
538 - */
539 - fd_flag = fcntl(p->pack_fd, F_GETFD, 0);
540 - if (fd_flag < 0)
541 - return error("cannot determine file descriptor flags");
542 - fd_flag |= FD_CLOEXEC;
543 - if (fcntl(p->pack_fd, F_SETFD, fd_flag) == -1)
544 - return error("cannot set FD_CLOEXEC");
545 -
535 /* Verify we recognize this pack file format. */
536 read_result = read_in_full(p->pack_fd, &hdr, sizeof(hdr));
537 if (read_result < 0)