Skip to content

server: Open files in blocking mode in create_file

Aidan Hobson Sayers requested to merge aidanhs/wine:aphs-no-nonblock into master

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 !3390 (closed) for my original attempt at fixing this, particularly !3390 (comment 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

Merge request reports

Loading