Set mode in fdopen.