]> git.ipfire.org Git - thirdparty/git.git/commit
reftable/stack: adapt `stack_filename()` to handle allocation failures
authorPatrick Steinhardt <ps@pks.im>
Thu, 17 Oct 2024 04:54:13 +0000 (06:54 +0200)
committerTaylor Blau <me@ttaylorr.com>
Thu, 17 Oct 2024 20:59:56 +0000 (16:59 -0400)
commit591c6a600e0ef1bfc71d66d74b64bf47de62fc8e
tree5a502600e5e5d0976f324a6457e304b727bb3353
parent4abc8022ffae64bb24e93153c75bc880991bb2dc
reftable/stack: adapt `stack_filename()` to handle allocation failures

The `stack_filename()` function cannot pass any errors to the caller as it
has a `void` return type. Adapt it and its callers such that we can
handle errors and start handling allocation failures.

There are two interesting edge cases in `reftable_stack_destroy()` and
`reftable_addition_close()`. Both of these are trying to tear down their
respective structures, and while doing so they try to unlink some of the
tables they have been keeping alive. Any earlier attempts to do that may
fail on Windows because it keeps us from deleting such tables while they
are still open, and thus we re-try on close. It's okay and even expected
that this can fail when the tables are still open by another process, so
we handle the allocation failures gracefully and just skip over any file
whose name we couldn't figure out.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
reftable/stack.c