mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
* ftpfs.c (command): Fix misuse of the status variable. Don't
cache the value of SUP.sock before reconnect.
This commit is contained in:
parent
44b8819b9a
commit
f40cf73bbd
@ -1,3 +1,8 @@
|
|||||||
|
2003-06-21 Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>
|
||||||
|
|
||||||
|
* ftpfs.c (command): Fix misuse of the status variable. Don't
|
||||||
|
cache the value of SUP.sock before reconnect.
|
||||||
|
|
||||||
2003-06-05 Pavel Roskin <proski@gnu.org>
|
2003-06-05 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
* vfs.c: Rename mc_return_cwd() to _vfs_get_cwd(). Move
|
* vfs.c: Rename mc_return_cwd() to _vfs_get_cwd(). Move
|
||||||
|
50
vfs/ftpfs.c
50
vfs/ftpfs.c
@ -319,55 +319,59 @@ static int
|
|||||||
command (vfs *me, vfs_s_super *super, int wait_reply, const char *fmt, ...)
|
command (vfs *me, vfs_s_super *super, int wait_reply, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char *str, *fmt_str;
|
char *cmdstr;
|
||||||
int status;
|
int status, cmdlen;
|
||||||
int sock = SUP.sock;
|
|
||||||
|
|
||||||
va_start (ap, fmt);
|
va_start (ap, fmt);
|
||||||
fmt_str = g_strdup_vprintf (fmt, ap);
|
cmdstr = g_strdup_vprintf (fmt, ap);
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
|
|
||||||
status = strlen (fmt_str);
|
cmdlen = strlen (cmdstr);
|
||||||
str = g_realloc (fmt_str, status + 3);
|
cmdstr = g_realloc (cmdstr, cmdlen + 3);
|
||||||
strcpy (str + status, "\r\n");
|
strcpy (cmdstr + cmdlen, "\r\n");
|
||||||
|
cmdlen += 2;
|
||||||
|
|
||||||
if (logfile){
|
if (logfile) {
|
||||||
if (strncmp (str, "PASS ", 5) == 0){
|
if (strncmp (cmdstr, "PASS ", 5) == 0) {
|
||||||
fputs ("PASS <Password not logged>\r\n", logfile);
|
fputs ("PASS <Password not logged>\r\n", logfile);
|
||||||
} else
|
} else
|
||||||
fwrite (str, status + 2, 1, logfile);
|
fwrite (cmdstr, cmdlen, 1, logfile);
|
||||||
|
|
||||||
fflush (logfile);
|
fflush (logfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
got_sigpipe = 0;
|
got_sigpipe = 0;
|
||||||
enable_interrupt_key ();
|
enable_interrupt_key ();
|
||||||
status = write (SUP.sock, str, status + 2);
|
status = write (SUP.sock, cmdstr, cmdlen);
|
||||||
|
|
||||||
if (status < 0){
|
if (status < 0) {
|
||||||
code = 421;
|
code = 421;
|
||||||
|
|
||||||
if (errno == EPIPE){ /* Remote server has closed connection */
|
if (errno == EPIPE) { /* Remote server has closed connection */
|
||||||
static int level = 0; /* login_server() use command() */
|
static int level = 0; /* login_server() use command() */
|
||||||
if (level == 0){
|
if (level == 0) {
|
||||||
level = 1;
|
level = 1;
|
||||||
status = reconnect (me, super);
|
status = reconnect (me, super);
|
||||||
level = 0;
|
level = 0;
|
||||||
if (status && write (SUP.sock, str, status + 2) > 0)
|
if (status && (write (SUP.sock, cmdstr, cmdlen) > 0)) {
|
||||||
goto ok;
|
goto ok;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
got_sigpipe = 1;
|
got_sigpipe = 1;
|
||||||
}
|
}
|
||||||
g_free (str);
|
g_free (cmdstr);
|
||||||
disable_interrupt_key ();
|
disable_interrupt_key ();
|
||||||
return TRANSIENT;
|
return TRANSIENT;
|
||||||
}
|
}
|
||||||
ok:
|
ok:
|
||||||
g_free (str);
|
g_free (cmdstr);
|
||||||
disable_interrupt_key ();
|
disable_interrupt_key ();
|
||||||
|
|
||||||
if (wait_reply)
|
if (wait_reply)
|
||||||
return get_reply (me, sock, (wait_reply & WANT_STRING) ? reply_str : NULL, sizeof (reply_str)-1);
|
return get_reply (me, SUP.sock,
|
||||||
|
(wait_reply & WANT_STRING) ? reply_str : NULL,
|
||||||
|
sizeof (reply_str) - 1);
|
||||||
return COMPLETE;
|
return COMPLETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user