The code handling errors while connecting to remote host didn't backed up the error value until checking it. The error value was therefore overwritten by a different error value before checking.
As a result, lftp failed to connect to a remote host if the client host didn't have IPv6 connection, but the remote host domain name was resolved also to IPv6 addresses. Therefore lftp failed to connect to the first IPv6 remote host address and existed.
The error checking code was fixed to back up the appropriate error value before checking. Therefore the value is now not overwritten and the right error value is checked later on.
As a result lftp is not able to connect to a remote host which domain name resolves to also IPv6 addresses, from the client which has only IPv4 connectivity.