tempfile: set errno to a known value before calling ferror()