Skip to content

Report immediate writesf output errors - #25

Closed
omrzk wants to merge 1 commit into
troglobit:masterfrom
omrzk:fix/report-procval-write-errors
Closed

omrzk wants to merge 1 commit into
troglobit:masterfrom
omrzk:fix/report-procval-write-errors

Conversation

@omrzk

@omrzk omrzk commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

writesf() ignores an immediate fprintf() error and returns only fclose()'s result. A large write to /dev/full, or a write through the supported mode argument opened as read-only, can therefore return success after no data was written.

Return the original write error while still closing the stream. Deferred buffered-write errors continue to come from fclose().

Validation: the new regression fails on current master and passes with this change. It exercises read-only output, short and large /dev/full writes across buffer boundaries, descriptor reuse after repeated errors, normal multiline writes, append/truncate modes, empty strings, formatted paths, existing reader helpers, and open failures. Strict GCC and ASan/UBSan/LeakSanitizer checks pass. GCC 13 full build passes. Full make check passes 23 of 24 tests; pidfile cannot write /var/tmp here, reproduced using the exact current master test and dependencies. make distcheck includes and passes the new regression, then hits the same limitation; native Clang, Debian packaging, actual proc/sys device writes and other operating systems were not tested locally.

@troglobit troglobit closed this in 0013f4f Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant