From 6b18a52414dec1bd017b32fa469873f1b1e0f96e Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 27 Aug 2001 14:51:31 +0000 Subject: [PATCH] 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. git-svn-id: svn://svn.tartarus.org/sgt/putty@1211 cda61777-01e9-0310-a592-d414129be87e --- scp.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scp.c b/scp.c index 7b5dbe2a..7ab31207 100644 --- a/scp.c +++ b/scp.c @@ -1089,6 +1089,14 @@ int scp_sink_setup(char *source, int preserve, int recursive) * slash. */ 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. */ fname = scp_sftp_remotepath; +printf("oi :%s:\n", fname); must_free_fname = 0; scp_sftp_donethistarget = 1; } else { @@ -1187,10 +1196,12 @@ int scp_get_sink_action(struct scp_sink_action *act) !wc_match(head->wildcard, head->names[head->namepos].filename)))) head->namepos++; /* skip . and .. */ +printf("ooh\n"); if (head->namepos < head->namelen) { fname = dupcat(head->dirpath, "/", head->names[head->namepos++].filename, NULL); +printf("got :%s:\n", fname); must_free_fname = 1; } else { /* @@ -1213,7 +1224,7 @@ int scp_get_sink_action(struct scp_sink_action *act) return 0; } } - +printf("filename :%s:\n", fname); /* * Now we have a filename. Stat it, and see if it's a file * or a directory. -- 2.11.0