reset errno to 0 after calling isatty
Merge pull request #74 from choplin/reset_errno

reset errno to 0 after calling isatty