Make sure to save/restore errno in signal handlers