mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-15 01:57:40 -05:00
Centralise stripslashes() and make it OS-sensitive.
I noticed that Unix PSCP was unwantedly renaming downloaded files which had a backslash in their names, because pscp.c's stripslashes() treated \ as a path component separator, since it hadn't been modified since PSCP ran on Windows only. It also turns out that pscp.c, psftp.c and winsftp.c all had a stripslashes(), and they didn't all have quite the same prototype. So now there's one in winsftp.c and one in uxsftp.c, with appropriate OS-dependent behaviour, and the ones in pscp.c and psftp.c are gone.
This commit is contained in:
@ -413,6 +413,20 @@ void finish_wildcard_matching(WildcardMatcher *dir) {
|
||||
sfree(dir);
|
||||
}
|
||||
|
||||
char *stripslashes(const char *str, int local)
|
||||
{
|
||||
char *p;
|
||||
|
||||
/*
|
||||
* On Unix, we do the same thing regardless of the 'local'
|
||||
* parameter.
|
||||
*/
|
||||
p = strrchr(str, '/');
|
||||
if (p) str = p+1;
|
||||
|
||||
return (char *)str;
|
||||
}
|
||||
|
||||
int vet_filename(const char *name)
|
||||
{
|
||||
if (strchr(name, '/'))
|
||||
|
Reference in New Issue
Block a user