Re: [PATCH v2 2/3] refs/files-backend: stop setting errno from lock_ref_oid_basic
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 28, 2021, 04:20 UTC
- Message-ID
- <xmqqzgxjavks.fsf@gitster.g>
- In-Reply-To
- <db5da7d7fb5178c14c1f5733d35bb69813c9c644.1619191907.git.gitgitgadget@gmail.com>
"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 19 quoted lines
> From: Han-Wen Nienhuys <hanwen@google.com> > > Errno is a global variable written by almost all system calls, and therefore it > is hard to reason about its state. > > This is a functional noop, because calls to lock_ref_oid_basic() in this file > are followed by: > > * lock_ref_oid_basic (copy/rename rollback error path) > > * write_ref_to_lockfile (both in the rollback path and the success path of > copy/rename) > > * create_symref_locked (files_create_symref) > > * refs_reflog_exists (reflog expiry) > > These calls do I/O and therefore clobber errno. They are not inspecting the > incoming errno.
Hmph, are you saying that these calls do I/O and always the I/O would fail? A system call that is successfull don't touch errno; only the calls that resulted in failure do.