jgoerzen / ftphs

FTP client and server library [Haskell]
http://wiki.github.com/jgoerzen/ftphs/
GNU Lesser General Public License v2.1
16 stars 16 forks source link

FD leak in connectFTP #22

Open defanor opened 5 years ago

defanor commented 5 years ago

connectFTP doesn't close sockets on connection failure, only throwing an exception. I'm not sure whether it would be more appropriate to fix in connectFTP itself or in MissingH's connectTCP/connectTCPAddr (since it's not clear what is the intended behaviour of connectTCP), but in programs using connectFTP there's no socket to close, so apparently should be fixed in one of those.

defanor commented 5 years ago

Although it looks like connectTCPAddr should handle that, since leaking file descriptors from it doesn't seem like a sensible behaviour. Submitted a PR there, and perhaps ftphs should just increase the required MissingH version once/if it will be fixed there.