Repository navigation
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Previously they returned the number of characters it output at the time of the error, but that is not only contrary to what POSIX does, it also makes it next to impossible for a caller to know when for example the output failed because out of disk space or similar. Verified by test 2380 Closes #23112
bagder
force-pushed
the
bagder/fprintf-fail
branch
from
September 26, 2026 08:40
656df08 to
bf582f1
Compare
bagder
marked this pull request as ready for review
September 26, 2026 08:40
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The regression test currently succeeds even when curl_mfprintf never returns -1.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Updates curl’s printf wrappers to report output failures consistently with POSIX behavior.
Changes:
- Return
-1when file output fails. - Add an
RLIMIT_FSIZEregression test. - Document the new return behavior.
| File | Description |
|---|---|
lib/mprintf.c |
Tracks and reports stream write failures. |
docs/libcurl/curl_mprintf.md |
Documents error return semantics. |
tests/libtest/lib2380.c |
Exercises output failure handling. |
tests/libtest/Makefile.inc |
Registers the new libtest. |
tests/data/test2380 |
Defines the test case. |
tests/data/Makefile.am |
Registers the test data. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Previously they returned the number of characters it output at the time of the error, but that is not only contrary to what POSIX does, it also makes it next to impossible for a caller to know when for example the output failed because out of disk space or similar.