Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close file descriptor in accept when exception happens #569

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Network/Socket/Syscall.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#endif

#if defined(mingw32_HOST_OS)
import Foreign (FunPtr)

Check warning on line 14 in Network/Socket/Syscall.hs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 8.10)

The import of ‘Foreign’ is redundant

Check warning on line 14 in Network/Socket/Syscall.hs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 9.0)

The import of ‘Foreign’ is redundant

Check warning on line 14 in Network/Socket/Syscall.hs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 9.2)

The import of ‘Foreign’ is redundant

Check warning on line 14 in Network/Socket/Syscall.hs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 9.4)

The import of ‘Foreign’ is redundant

Check warning on line 14 in Network/Socket/Syscall.hs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 9.6)

The import of ‘Foreign’ is redundant
import GHC.Conc (asyncDoProc)
#else
import Foreign.C.Error (getErrno, eINTR, eINPROGRESS)
Expand Down Expand Up @@ -191,7 +191,7 @@
accept :: SocketAddress sa => Socket -> IO (Socket, sa)
accept listing_sock = withNewSocketAddress $ \new_sa sz ->
withFdSocket listing_sock $ \listing_fd -> do
new_sock <- callAccept listing_fd new_sa sz >>= mkSocket
new_sock <- E.bracketOnError (callAccept listing_fd new_sa sz) c_close mkSocket
new_addr <- peekSocketAddress new_sa
return (new_sock, new_addr)
where
Expand Down