Do not reset file flags when setting O_NONBLOCK.

It is necessary to get flags before setting O_NONBLOCK to a file
descriptor to prevent other flags.