fileno(3): set errno when returning -1
PR: 283014
(cherry picked from commit 7cd756ff4fe7e65a9a3f588904998bf6f4b37623)