diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-08-25 14:57:10 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-08-25 14:57:10 -0700 |
commit | 9b8d731995c68d590453ccb7ba8344ea96fb2b98 (patch) | |
tree | 631a8d4d5653eb221950ce7a5d5d21feaf0ab968 /sha1_file.c | |
parent | db86e61cbbc4c59a0886366bbf392498e64b53c8 (diff) | |
parent | dff6f280dff2b1d0d379ed0e73058819702d0f07 (diff) | |
download | git-9b8d731995c68d590453ccb7ba8344ea96fb2b98.tar.gz |
Merge branch 'cb/open-noatime-clear-errno'
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.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c index ea78ba7cf0..08302f5857 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -1494,7 +1494,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; |