You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "anchao (via GitHub)" <gi...@apache.org> on 2026/10/21 05:23:22 UTC
[PR] fs/hostfs: close host fd on append seek failure [nuttx]
anchao opened a new pull request, #20857:
URL: https://github.com/apache/nuttx/pull/20857
## Summary
Fix a host file descriptor leak in `hostfs_open()`.
`hostfs_open()` opens the host file first, then seeks to the end when the
file is opened with `O_APPEND`. If that append seek failed, the previous
error path freed the hostfs file structure but did not close the host file
descriptor that had already been opened.
This change routes the append seek failure through a cleanup path that
closes the host file descriptor before freeing the hostfs file structure.
## Impact
- Prevents leaking the host file descriptor when `O_APPEND` setup fails.
- Keeps the successful open path unchanged.
- Only affects the error path after `host_open()` succeeds and
`host_lseek(..., SEEK_END)` fails.
## Testing
sim/nsh2
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fs/hostfs: close host fd on append seek failure [nuttx]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20857:
URL: https://github.com/apache/nuttx/pull/20857#issuecomment-6309814928
<!-- membrowse-pr-comment -->
## <img src="https://membrowse.com/membrowse-logo.svg" height="24" align="top"> MemBrowse Memory Report · [Explore what changed →](https://membrowse.com/public/apache/nuttx?commit_sha=28365e7d10f606a8f3a71ab86d2349685d9b2b83)
### [qemu-armv8a](https://membrowse.com/public/apache/nuttx/target/qemu-armv8a/compare?head=28365e7d10f606a8f3a71ab86d2349685d9b2b83&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
- **Code**: .text.hostfs_open +8 B (+0.0%, 351,920 B)
*No memory changes detected for:*
- [arduino-mega2560](https://membrowse.com/public/apache/nuttx/target/arduino-mega2560/compare?head=28365e7d10f606a8f3a71ab86d2349685d9b2b83&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
- [esp32-devkitc](https://membrowse.com/public/apache/nuttx/target/esp32-devkitc/compare?head=28365e7d10f606a8f3a71ab86d2349685d9b2b83&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
- [hifive1-revb](https://membrowse.com/public/apache/nuttx/target/hifive1-revb/compare?head=28365e7d10f606a8f3a71ab86d2349685d9b2b83&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
- [mirtoo](https://membrowse.com/public/apache/nuttx/target/mirtoo/compare?head=28365e7d10f606a8f3a71ab86d2349685d9b2b83&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
- [qemu-intel64](https://membrowse.com/public/apache/nuttx/target/qemu-intel64/compare?head=28365e7d10f606a8f3a71ab86d2349685d9b2b83&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
- [rx65n-rsk2mb](https://membrowse.com/public/apache/nuttx/target/rx65n-rsk2mb/compare?head=28365e7d10f606a8f3a71ab86d2349685d9b2b83&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
- [s698pm-dkit](https://membrowse.com/public/apache/nuttx/target/s698pm-dkit/compare?head=28365e7d10f606a8f3a71ab86d2349685d9b2b83&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
- [stm32-nucleo-f103rb](https://membrowse.com/public/apache/nuttx/target/stm32-nucleo-f103rb/compare?head=28365e7d10f606a8f3a71ab86d2349685d9b2b83&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
---
<sub>Catch memory regressions in CI with [MemBrowse](https://membrowse.com). Free for open source.</sub>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fs/hostfs: close host fd on append seek failure [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #20857:
URL: https://github.com/apache/nuttx/pull/20857
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org