Page MenuHomeFreeBSD

savecore: bail on write error even when decompressing
ClosedPublic

Authored by rlibby on Dec 10 2020, 8:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 15, 12:09 AM
Unknown Object (File)
Oct 15 2024, 4:05 AM
Unknown Object (File)
Sep 24 2024, 2:52 PM
Unknown Object (File)
Sep 24 2024, 2:52 PM
Unknown Object (File)
Sep 24 2024, 10:00 AM
Unknown Object (File)
Sep 17 2024, 3:33 AM
Unknown Object (File)
Sep 16 2024, 3:54 PM
Unknown Object (File)
Sep 16 2024, 1:20 PM
Subscribers

Details

Summary

gcc complained about the impossibility of the test nw < 0 in
DoRegularFile where nw is unsigned. Looking further, this was
preventing code from logging an error writing to the output file while
decompressing.

Test Plan

Tested by doing a zstd dump and then trying to savecore -u it to a
too-small tmpfs fs. Before this patch, savecore "succeeds" (exits 0)
but leaves a truncated core file. After this patch, savecore fails
(exits 1).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Dec 10 2020, 10:16 PM

Should we also add an fflush/fsync? We are now successfully failing--because we get an error early enough, but that is not guaranteed. Waiting for savecore to fsync could slow it down slightly, but that seems okay, given how rare this usually is.