On Thu, Jun 3, 2021 at 4:33 AM Jonathan Tan <jonathantanmy@xxxxxxxxxx> wrote: > > Errno is a global variable written by almost all system calls, and therefore it > > is hard to reason about its state. It's also useless for user-visible errors, as > > it leaves no place to report the offending file and/or syscall. > > I don't think this paragraph is useful. Dropped. > This is probably written more clearly as follows: > > No call to the static function lock_ref_oid_basic() is immediately > followed by an errno check, so stopping setting errno is safe. But as a > sanity check, lock_ref_oid_basic() is used in these functions: > - files_copy_or_rename_ref() - here, calls are followed by error() (which > performs I/O) or write_ref_to_lockfile() (which calls parse_object() which > may perform I/O) > - files_create_symref() - here, calls are followed by error() or > create_symref_locked() (which performs I/O and does not inspect > errno) > - files_reflog_expire() - here, calls are followed by error() or > refs_reflog_exists() (which calls a function in a vtable that is not > documented to use and/or preserve errno) > > So it is safe to stop setting errno in lock_ref_oid_basic(). I used some of the above text. -- Han-Wen Nienhuys - Google Munich I work 80%. Don't expect answers from me on Fridays. -- Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Paul Manicle, Halimah DeLaine Prado