Re: [PATCH v9 6/7] refs: explicitly return failure_errno from parse_loose_ref_contents
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- Aug 13, 2021, 20:54 UTC
- Message-ID
- <20210813205449.1198555-1-jonathantanmy@google.com>
- In-Reply-To
- <patch-6.7-57e3f246f4f-20210720T102644Z-avarab@gmail.com>
Show 9 quoted lines
> @@ -448,26 +454,28 @@ static int files_read_raw_ref(struct ref_store *ref_store, const char *refname,
> }
> strbuf_reset(&sb_contents);
> if (strbuf_read(&sb_contents, fd, 256) < 0) {
> - int save_errno = errno;
> close(fd);
> - errno = save_errno;
> goto out;
> }[snip unrelated code]
> out:
> - *failure_errno = errno;
> + if (ret && !myerr)
> + BUG("returning non-zero %d, should have set myerr!", ret);At $DAYJOB, some people have observed this BUG triggering. Right now I don't have a consistent reproduction recipe, but we noticed that the block starting with "if (strbuf_read" quoted above does not set myerr upon an error, and instead immediately jumps to "out" with ret being -1.