Skip to content

Commit 280738c

Browse files
Eric Wonggitster
authored andcommitted
packfile: remove redundant fcntl F_GETFD/F_SETFD
git_open sets close-on-exec since cd66ada ("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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d9589d4 commit 280738c

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

packfile.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,6 @@ static int open_packed_git_1(struct packed_git *p)
489489
struct pack_header hdr;
490490
unsigned char hash[GIT_MAX_RAWSZ];
491491
unsigned char *idx_hash;
492-
long fd_flag;
493492
ssize_t read_result;
494493
const unsigned hashsz = the_hash_algo->rawsz;
495494

@@ -533,16 +532,6 @@ static int open_packed_git_1(struct packed_git *p)
533532
} else if (p->pack_size != st.st_size)
534533
return error("packfile %s size changed", p->pack_name);
535534

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-
546535
/* Verify we recognize this pack file format. */
547536
read_result = read_in_full(p->pack_fd, &hdr, sizeof(hdr));
548537
if (read_result < 0)

0 commit comments

Comments
 (0)