mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-08 18:19:08 +08:00
cygwin: pread/pwrite: prevent EBADF error after fork()
If the parent process has already used pread() or pwrite(), these functions fail with EBADF if used on the inherited fd. Ensure that fix_after_fork() is called to invalidate the prw_handle. This issue has been detected by 'stress-ng --pseek 1'. Fixes: c36cd56c548a ("* fhandler.cc (fhandler_base::open): Drop local create_options variable.") Signed-off-by: Christian Franke <christian.franke@t-online.de>
This commit is contained in:
parent
c7fe29f5cb
commit
0281d2c8e2
@ -1810,6 +1810,9 @@ fhandler_disk_file::prw_open (bool write, void *aio)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* prw_handle is invalid after fork. */
|
||||
need_fork_fixup (true);
|
||||
|
||||
/* record prw_handle's asyncness for subsequent pread/pwrite operations */
|
||||
prw_handle_isasync = !!aio;
|
||||
return 0;
|
||||
|
@ -7,3 +7,6 @@ Fixes:
|
||||
|
||||
- Fix a regression in 3.5.4 that writing to pipe extremely slows down.
|
||||
Addresses: https://cygwin.com/pipermail/cygwin/2024-August/256398.html
|
||||
|
||||
- Fix pread() and pwrite() EBADF error after fork().
|
||||
Addresses: https://sourceware.org/pipermail/cygwin/2024-September/256468.html
|
||||
|
Loading…
x
Reference in New Issue
Block a user