Skip to content

Commit cbcd3dc

Browse files
committed
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
2 parents 03ea027 + dff6f28 commit cbcd3dc

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
@@ -1461,7 +1461,10 @@ int git_open_noatime(const char *name)
14611461
static int sha1_file_open_flag = O_NOATIME;
14621462

14631463
for (;;) {
1464-
int fd = open(name, O_RDONLY | sha1_file_open_flag);
1464+
int fd;
1465+
1466+
errno = 0;
1467+
fd = open(name, O_RDONLY | sha1_file_open_flag);
14651468
if (fd >= 0)
14661469
return fd;
14671470

0 commit comments

Comments
 (0)