file_send_sendfile() in src/shared/file.c:456-463 calls sendfile() in a loop. If sendfile() returns -1 with errno == EAGAIN or EINTR, the function treats it as a fatal error and returns false. On a non-blocking or busy socket, this can cause unnecessary transfer failures. The function also does not use errno correctly to distinguish recoverable errors from true failures.
Location
src/shared/file.c:458-463 — sendfile() loop.
Suggested fix
Check errno after sendfile() returns -1.
Retry on EAGAIN (after poll()/select() for write readiness) and EINTR.
Use sendfile() only for regular files; fall back to read()/write() for non-regular files.
Severity
Low
Category
bug, performance
This issue was automatically generated by the issue-creator agent.
## Description
`file_send_sendfile()` in `src/shared/file.c:456-463` calls `sendfile()` in a loop. If `sendfile()` returns `-1` with `errno == EAGAIN` or `EINTR`, the function treats it as a fatal error and returns false. On a non-blocking or busy socket, this can cause unnecessary transfer failures. The function also does not use `errno` correctly to distinguish recoverable errors from true failures.
## Location
- `src/shared/file.c:458-463` — `sendfile()` loop.
## Suggested fix
1. Check `errno` after `sendfile()` returns `-1`.
2. Retry on `EAGAIN` (after `poll()`/select() for write readiness) and `EINTR`.
3. Use `sendfile()` only for regular files; fall back to `read()`/`write()` for non-regular files.
## Severity
Low
## Category
bug, performance
---
_This issue was automatically generated by the issue-creator agent._
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Description
file_send_sendfile()insrc/shared/file.c:456-463callssendfile()in a loop. Ifsendfile()returns-1witherrno == EAGAINorEINTR, the function treats it as a fatal error and returns false. On a non-blocking or busy socket, this can cause unnecessary transfer failures. The function also does not useerrnocorrectly to distinguish recoverable errors from true failures.Location
src/shared/file.c:458-463—sendfile()loop.Suggested fix
errnoaftersendfile()returns-1.EAGAIN(afterpoll()/select() for write readiness) andEINTR.sendfile()only for regular files; fall back toread()/write()for non-regular files.Severity
Low
Category
bug, performance
This issue was automatically generated by the issue-creator agent.