mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 08:12:28 +00:00
Fix file descriptor assignment issues on Windows
This commit is contained in:
parent
b73673e984
commit
c3482af66d
2 changed files with 46 additions and 1 deletions
|
@ -72,7 +72,7 @@ int __reservefd_unlocked(int start) {
|
|||
if (_cmpxchg(&g_fds.p[fd].kind, kFdEmpty, kFdReserved)) {
|
||||
// g_fds.f isn't guarded by our mutex
|
||||
do {
|
||||
f2 = MAX(fd + 1, f1);
|
||||
f2 = MIN(fd + 1, f1);
|
||||
} while (!atomic_compare_exchange_weak_explicit(
|
||||
&g_fds.f, &f1, f2, memory_order_release, memory_order_relaxed));
|
||||
return fd;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue