reduce errno calls

A random optimization patch hanging out in my git. I dont think it should affect any bugs or create any new ones.