summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-09-03 19:17:49 -0700
committerJunio C Hamano <gitster@pobox.com>2015-09-03 19:17:49 -0700
commitcbcd3dcaa8e504779523959ccf8771fdb32f2d2a (patch)
tree064019c85efadf486be00b0b546ed0482aba35a1 /sha1_file.c
parent03ea02771a3752b81db355d70adf430f217b5d7a (diff)
parentdff6f280dff2b1d0d379ed0e73058819702d0f07 (diff)
downloadgit-cbcd3dcaa8e504779523959ccf8771fdb32f2d2a.tar.gz
Merge branch 'cb/open-noatime-clear-errno' into maint
When trying to see that an object does not exist, a state errno leaked from our "first try to open a packfile with O_NOATIME and then if it fails retry without it" logic on a system that refuses O_NOATIME. This confused us and caused us to die, saying that the packfile is unreadable, when we should have just reported that the object does not exist in that packfile to the caller. * cb/open-noatime-clear-errno: git_open_noatime: return with errno=0 on success
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 1cee438422..f2e993e0b8 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1461,7 +1461,10 @@ int git_open_noatime(const char *name)
static int sha1_file_open_flag = O_NOATIME;
for (;;) {
- int fd = open(name, O_RDONLY | sha1_file_open_flag);
+ int fd;
+
+ errno = 0;
+ fd = open(name, O_RDONLY | sha1_file_open_flag);
if (fd >= 0)
return fd;