Files
swift-nio/Sources
Cory Benfield f7c4655298 Avoid double-closing on fcntl failures (#2409)
Motivation:

The fix provided in #2407 was subtly wrong. ignoreSIGPIPE, which throws
the error in question, closes the FD on error _except_ on EINVAL from
fcntl, where it instead does not. This inconsistent behaviour is the
source of the bug. Because this behaviour is inconsistent, the fix from
PR #2407 is also inconsistent and can in some cases double-close the
socket.

The actual issue is not as old as I expected: the code can be observed
by reviewing the change in #1598, which incorrectly inserted the error
transformation before the call to close.

Modifications:

- Revert the change from #2407.
- Move the close in ignoreSIGPIPE to before the error check, rather than
  after, so we unconditionally execute it.

Result:

More resilient fix.
2023-04-20 12:40:39 +01:00
..
2021-01-22 18:39:10 +00:00
2023-04-17 08:40:35 +01:00
2023-04-17 08:40:35 +01:00
2023-04-17 08:40:35 +01:00
2023-04-17 08:40:35 +01:00
2023-04-17 08:40:35 +01:00
2023-04-17 08:40:35 +01:00