# Re: \[PATCH v8 2/2\] tools/bootconfig: fix fd leak in load\_xbc\_file() on fstat failure

- From: Markus Elfring \<hidden\>
- Date: 2026-03-18 20:08:21 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2026/03/3467351
- Thread: https://ratatoskr.run/linux-trace-kernel/2026/03/3466863/t.md

```text
> If fstat() fails after open() succeeds, the function returns without
> closing the file descriptor. Also preserve errno across close(), since
> close() may overwrite it before the error is returned.

I find such a change description improvable.

Did anything hinder to use a corresponding goto chain?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v7.0-rc4#n526
https://elixir.bootlin.com/linux/v7.0-rc4/source/tools/bootconfig/main.c#L155-L173

Regards,
Markus
```
