Thanks very much for the analysis and suggested patch. I don't think however that a code change is needed. Arguably, the correct fix would be to check the return value of wprintf, but in fact close_stdout() already checks if there was a previous error on the stream. I think that arbitrarily setting a large buffer size is a bit of a hack, to be honest.
So I think it's sufficient, at the cost of a slightly less nice error message, to allow the code to proceed as at present, and instead to change the test so that it does not specifically check for "No space left on device", but instead just "write error". I attach an updated version of tests/atexit-1; please could you check that with it the test now passes with musl? (Also, of course let me know if you disagree with my analysis!) -- https://rrt.sc3d.org
atexit-1
Description: Binary data