This fixes a bug in wine when running on 9pfs where short reads would occur, causing binaries to be loaded incorrectly. All other filesystems on Linux ignore O_NONBLOCK for regular files, so this should not affect them.
Thanks to Paul Gofman for the advice on this fix.
---
Ref https://gitlab.winehq.org/wine/wine/-/merge_requests/3390 for my original attempt at fixing this, particularly https://gitlab.winehq.org/wine/wine/-/merge_requests/3390#note_40093 which describes the strange situation `O_NONBLOCK` finds itself in on filesystems.
The risk with this MR is that fifo, unix sockets or other special files opened via `open_unix_file` in ntdll will now have changed behaviour - but my quick look suggests that this is unlikely, as `open_unix_file` is only used for: - `dlls/ntdll/unix/file.c`: `NtCreateFile` and `NtDeleteFile` - `dlls/ntdll/unix/process.c`: loading PE information and getting a dirfd for the current directory - `dlls/ntdll/unix/env.c`: `open_nls_data_file` - `dlls/ntdll/unix/loader.c`: dll load functions - `dlls/ntdll/unix/registry.c`: `NtLoadKeyEx`
cc @gofman