Hi, I've put most of the details in
https://github.com/lavv17/lftp/issues/511 but basically this avoids segfault which I triggered by accident. Patch is accepted by upstream and already merged. Index: Makefile =================================================================== RCS file: /cvs/ports/net/lftp/Makefile,v retrieving revision 1.123 diff -u -p -u -r1.123 Makefile --- Makefile 24 Oct 2018 14:28:08 -0000 1.123 +++ Makefile 4 Mar 2019 12:37:56 -0000 @@ -4,7 +4,7 @@ COMMENT= shell-like command line ftp and DISTNAME= lftp-4.8.4 CATEGORIES= net -REVISION= 0 +REVISION= 1 HOMEPAGE= https://lftp.tech/ Index: patches/patch-doc_lftp_1 =================================================================== RCS file: /cvs/ports/net/lftp/patches/patch-doc_lftp_1,v retrieving revision 1.3 diff -u -p -u -r1.3 patch-doc_lftp_1 --- patches/patch-doc_lftp_1 13 Aug 2018 14:36:41 -0000 1.3 +++ patches/patch-doc_lftp_1 4 Mar 2019 12:37:56 -0000 @@ -1,5 +1,8 @@ $OpenBSD: patch-doc_lftp_1,v 1.3 2018/08/13 14:36:41 rsadowski Exp $ +- avoid information loss in both groff and mandoc + upstream commit 57b7098a4e0a7d3e7609ef3b2fb00b500df7a060 + Index: doc/lftp.1 --- doc/lftp.1.orig +++ doc/lftp.1 Index: patches/patch-src_Torrent_cc =================================================================== RCS file: patches/patch-src_Torrent_cc diff -N patches/patch-src_Torrent_cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_Torrent_cc 4 Mar 2019 12:37:56 -0000 @@ -0,0 +1,30 @@ +$OpenBSD$ + +- In MaySendUDP() handle case when socket may not be available yet + Upstream commit 66426abe60ef0f8a1be905f171b1281c6b59d138 + +- Add error handling for listen + Upstream commit 1f22423244c3867fec745cf0c04cd636e10970a2 + +Index: src/Torrent.cc +--- src/Torrent.cc.orig ++++ src/Torrent.cc +@@ -3830,7 +3830,8 @@ int TorrentListener::Do() + } + bound: + if(type==SOCK_STREAM) +- listen(sock,5); ++ if(listen(sock,5) < 0) ++ LogError(0,"listen failed: %s", strerror(errno)); + + // get the allocated port + socklen_t addr_len=sizeof(addr); +@@ -3904,6 +3905,8 @@ bool TorrentListener::MaySendUDP() + last_sent_udp_count=0; + last_sent_udp=now; + } ++ if (sock==-1) ++ return false; + // check if output buffer is available + struct pollfd pfd; + pfd.fd=sock; -- Regards, Mikolaj