Include the OS error (errno) in AutoFile/ BufferedFile exception messages when fread()/ fwrite()/ fseek() calls fail. I noticed these were missing while reviewing #35492, which moves DumpWallet from std::ofstream to AutoFile. With this PR, callers get the actual reason why the call failed (disk full, permission denied, bad file descriptor...) instead of just a fixed string like "AutoFile::write: write failed".
-Notes:
The first commit adds
streams_tests.cppcoverage asserting the current behaviour onmaster, with a TODO marking the assertion that the second commit (the actual fix) flips.Using this in
DumpWalletis left for later: theAutoFile-baseddump.cppfrom #35492 isn't on master yet, so it can be done in whichever PR gets merged second.