git: Try a bit harder not to lose errno in stdio