summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-01-10 15:24:26 -0800
committerJunio C Hamano <gitster@pobox.com>2017-01-10 15:24:26 -0800
commit02d0457eb4b9bf656965c5dbb613b8bfaef3316f (patch)
tree1cec6b47aa64274a4c154a00fefdf5c3d0bcfecc /read-cache.c
parente484bcbab1398e9a716e2e0e9de7928d9f796ef2 (diff)
parentb4d065df03049bacfbc40467b60b13e804b7d289 (diff)
downloadgit-02d0457eb4b9bf656965c5dbb613b8bfaef3316f.tar.gz
Merge branch 'jc/git-open-cloexec'
The codeflow of setting NOATIME and CLOEXEC on file descriptors Git opens has been simplified. We may want to drop the tip one, but we'll see. * jc/git-open-cloexec: sha1_file: stop opening files with O_NOATIME git_open_cloexec(): use fcntl(2) w/ FD_CLOEXEC fallback git_open(): untangle possible NOATIME and CLOEXEC interactions
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/read-cache.c b/read-cache.c
index f92a912dcb..2eca639cce 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -156,14 +156,7 @@ void fill_stat_cache_info(struct cache_entry *ce, struct stat *st)
static int ce_compare_data(const struct cache_entry *ce, struct stat *st)
{
int match = -1;
- static int cloexec = O_CLOEXEC;
- int fd = open(ce->name, O_RDONLY | cloexec);
-
- if ((cloexec & O_CLOEXEC) && fd < 0 && errno == EINVAL) {
- /* Try again w/o O_CLOEXEC: the kernel might not support it */
- cloexec &= ~O_CLOEXEC;
- fd = open(ce->name, O_RDONLY | cloexec);
- }
+ int fd = git_open_cloexec(ce->name, O_RDONLY);
if (fd >= 0) {
unsigned char sha1[20];