]> git.ipfire.org Git - thirdparty/git.git/commitdiff
packfile: remove redundant fcntl F_GETFD/F_SETFD
authorEric Wong <e@80x24.org>
Thu, 26 Dec 2019 10:42:19 +0000 (10:42 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 26 Dec 2019 18:09:35 +0000 (10:09 -0800)
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>
packfile.c

index c0d83fdfed973de8574224e46fb0afd4be0a98c9..518d9d5b54c58c9733ebb824c1673e09dbba4656 100644 (file)
@@ -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)