1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-05-30 00:04:49 -05:00

Fix tiny bug in new sftp-mode wildcards: when there wasn't a leading

path component (just `host:*' rather than `host:directory/*') there
was trouble.

[originally from svn r1211]
This commit is contained in:
Simon Tatham 2001-08-27 14:51:31 +00:00
parent e6c8913093
commit a8e0abbf28

13
scp.c
View File

@ -1089,6 +1089,14 @@ int scp_sink_setup(char *source, int preserve, int recursive)
* slash. * slash.
*/ */
lastpart[-1] = '\0'; lastpart[-1] = '\0';
} else if (!*dupsource) {
/*
* The remains of dupsource are _empty_ - the whole
* pathname was a wildcard. Hence we need to
* replace it with ".".
*/
sfree(dupsource);
dupsource = dupstr(".");
} }
/* /*
@ -1165,6 +1173,7 @@ int scp_get_sink_action(struct scp_sink_action *act)
* Simple case: we are only dealing with one file. * Simple case: we are only dealing with one file.
*/ */
fname = scp_sftp_remotepath; fname = scp_sftp_remotepath;
printf("oi :%s:\n", fname);
must_free_fname = 0; must_free_fname = 0;
scp_sftp_donethistarget = 1; scp_sftp_donethistarget = 1;
} else { } else {
@ -1187,10 +1196,12 @@ int scp_get_sink_action(struct scp_sink_action *act)
!wc_match(head->wildcard, !wc_match(head->wildcard,
head->names[head->namepos].filename)))) head->names[head->namepos].filename))))
head->namepos++; /* skip . and .. */ head->namepos++; /* skip . and .. */
printf("ooh\n");
if (head->namepos < head->namelen) { if (head->namepos < head->namelen) {
fname = dupcat(head->dirpath, "/", fname = dupcat(head->dirpath, "/",
head->names[head->namepos++].filename, head->names[head->namepos++].filename,
NULL); NULL);
printf("got :%s:\n", fname);
must_free_fname = 1; must_free_fname = 1;
} else { } else {
/* /*
@ -1213,7 +1224,7 @@ int scp_get_sink_action(struct scp_sink_action *act)
return 0; return 0;
} }
} }
printf("filename :%s:\n", fname);
/* /*
* Now we have a filename. Stat it, and see if it's a file * Now we have a filename. Stat it, and see if it's a file
* or a directory. * or a directory.