diff options
-rw-r--r-- | sha1_file.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c index 06c809aeeb..1e1edf4b25 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -1424,20 +1424,24 @@ static int open_sha1_file(const unsigned char *sha1) int fd; char *name = sha1_file_name(sha1); struct alternate_object_database *alt; + int most_interesting_errno; fd = git_open_noatime(name); if (fd >= 0) return fd; + most_interesting_errno = errno; prepare_alt_odb(); - errno = ENOENT; for (alt = alt_odb_list; alt; alt = alt->next) { name = alt->name; fill_sha1_path(name, sha1); fd = git_open_noatime(alt->base); if (fd >= 0) return fd; + if (most_interesting_errno == ENOENT) + most_interesting_errno = errno; } + errno = most_interesting_errno; return -1; } |