mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-05 19:14:27 +03:00
(ftpfs_open_data_connection): fix socket leak in case of unsuccessful ftp connection.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
adc6bd83d6
commit
ba20fac1b3
@ -1370,13 +1370,21 @@ ftpfs_open_data_connection (struct vfs_class *me, struct vfs_s_super *super, con
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (ftpfs_changetype (me, super, isbinary) == -1)
|
if (ftpfs_changetype (me, super, isbinary) == -1)
|
||||||
|
{
|
||||||
|
close (s);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (reget > 0)
|
if (reget > 0)
|
||||||
{
|
{
|
||||||
j = ftpfs_command (me, super, WAIT_REPLY, "REST %d", reget);
|
j = ftpfs_command (me, super, WAIT_REPLY, "REST %d", reget);
|
||||||
if (j != CONTINUE)
|
if (j != CONTINUE)
|
||||||
|
{
|
||||||
|
close (s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (remote)
|
if (remote)
|
||||||
{
|
{
|
||||||
char *remote_path = ftpfs_translate_path (me, super, remote);
|
char *remote_path = ftpfs_translate_path (me, super, remote);
|
||||||
@ -1389,7 +1397,10 @@ ftpfs_open_data_connection (struct vfs_class *me, struct vfs_s_super *super, con
|
|||||||
j = ftpfs_command (me, super, WAIT_REPLY, "%s", cmd);
|
j = ftpfs_command (me, super, WAIT_REPLY, "%s", cmd);
|
||||||
|
|
||||||
if (j != PRELIM)
|
if (j != PRELIM)
|
||||||
|
{
|
||||||
|
close (s);
|
||||||
ERRNOR (EPERM, -1);
|
ERRNOR (EPERM, -1);
|
||||||
|
}
|
||||||
tty_enable_interrupt_key ();
|
tty_enable_interrupt_key ();
|
||||||
if (SUP->use_passive_connection)
|
if (SUP->use_passive_connection)
|
||||||
data = s;
|
data = s;
|
||||||
|
Loading…
Reference in New Issue
Block a user