Skip to content

Commit 9b8d731

Browse files
committed
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
2 parents db86e61 + dff6f28 commit 9b8d731

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sha1_file.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1494,7 +1494,10 @@ int git_open_noatime(const char *name)
14941494
static int sha1_file_open_flag = O_NOATIME;
14951495

14961496
for (;;) {
1497-
int fd = open(name, O_RDONLY | sha1_file_open_flag);
1497+
int fd;
1498+
1499+
errno = 0;
1500+
fd = open(name, O_RDONLY | sha1_file_open_flag);
14981501
if (fd >= 0)
14991502
return fd;
15001503

0 commit comments

Comments
 (0)