fdopen should set errno when it fails due to invalid mode string