Invalidate remote directory completion cache if any command which

may change the remote contents completes successfully, including:
del, mdel, ren, mkdir, rmdir, quote, and all upload commands
Patch from Yar Tikhiy <yar@comp.chem.msu.su>.
This commit is contained in:
lukem 2003-07-31 07:06:41 +00:00
parent 90bb61be44
commit 8d51fbf035
2 changed files with 25 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmds.c,v 1.100 2002/11/30 03:10:55 lukem Exp $ */
/* $NetBSD: cmds.c,v 1.101 2003/07/31 07:06:41 lukem Exp $ */
/*-
* Copyright (c) 1996-2002 The NetBSD Foundation, Inc.
@ -107,7 +107,7 @@
#if 0
static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94";
#else
__RCSID("$NetBSD: cmds.c,v 1.100 2002/11/30 03:10:55 lukem Exp $");
__RCSID("$NetBSD: cmds.c,v 1.101 2003/07/31 07:06:41 lukem Exp $");
#endif
#endif /* not lint */
@ -1184,7 +1184,8 @@ delete(int argc, char *argv[])
code = -1;
return;
}
(void)command("DELE %s", argv[1]);
if (command("DELE %s", argv[1]) == COMPLETE)
dirchange = 1;
}
/*
@ -1214,7 +1215,8 @@ mdelete(int argc, char *argv[])
continue;
}
if (mflag && confirm(argv[0], cp)) {
(void)command("DELE %s", cp);
if (command("DELE %s", cp) == COMPLETE)
dirchange = 1;
if (!mflag && fromatty) {
ointer = interactive;
interactive = 1;
@ -1244,8 +1246,9 @@ renamefile(int argc, char *argv[])
code = -1;
return;
}
if (command("RNFR %s", argv[1]) == CONTINUE)
(void)command("RNTO %s", argv[2]);
if (command("RNFR %s", argv[1]) == CONTINUE &&
command("RNTO %s", argv[2]) == COMPLETE)
dirchange = 1;
}
/*
@ -1552,6 +1555,7 @@ lpwd(int argc, char *argv[])
void
makedir(int argc, char *argv[])
{
int r;
if (argc == 0 || argc > 2 ||
(argc == 1 && !another(&argc, &argv, "directory-name"))) {
@ -1559,12 +1563,15 @@ makedir(int argc, char *argv[])
code = -1;
return;
}
if (command("MKD %s", argv[1]) == ERROR && code == 500) {
r = command("MKD %s", argv[1]);
if (r == ERROR && code == 500) {
if (verbose)
fputs("MKD command not recognized, trying XMKD.\n",
ttyout);
(void)command("XMKD %s", argv[1]);
r = command("XMKD %s", argv[1]);
}
if (r == COMPLETE)
dirchange = 1;
}
/*
@ -1573,6 +1580,7 @@ makedir(int argc, char *argv[])
void
removedir(int argc, char *argv[])
{
int r;
if (argc == 0 || argc > 2 ||
(argc == 1 && !another(&argc, &argv, "directory-name"))) {
@ -1580,12 +1588,15 @@ removedir(int argc, char *argv[])
code = -1;
return;
}
if (command("RMD %s", argv[1]) == ERROR && code == 500) {
r = command("RMD %s", argv[1]);
if (r == ERROR && code == 500) {
if (verbose)
fputs("RMD command not recognized, trying XRMD.\n",
ttyout);
(void)command("XRMD %s", argv[1]);
r = command("XRMD %s", argv[1]);
}
if (r == COMPLETE)
dirchange = 1;
}
/*
@ -1642,6 +1653,7 @@ quote1(const char *initial, int argc, char *argv[])
while (getreply(0) == PRELIM)
continue;
}
dirchange = 1;
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: ftp.c,v 1.120 2002/06/05 10:20:49 lukem Exp $ */
/* $NetBSD: ftp.c,v 1.121 2003/07/31 07:06:41 lukem Exp $ */
/*-
* Copyright (c) 1996-2002 The NetBSD Foundation, Inc.
@ -103,7 +103,7 @@
#if 0
static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94";
#else
__RCSID("$NetBSD: ftp.c,v 1.120 2002/06/05 10:20:49 lukem Exp $");
__RCSID("$NetBSD: ftp.c,v 1.121 2003/07/31 07:06:41 lukem Exp $");
#endif
#endif /* not lint */
@ -745,6 +745,7 @@ sendrequest(const char *cmd, const char *local, const char *remote,
if (command("%s", cmd) != PRELIM)
goto cleanupsend;
}
dirchange = 1;
dout = dataconn(lmode);
if (dout == NULL)
goto abort;