Fix tiny bug in new sftp-mode wildcards: when there wasn't a leading
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Mon, 27 Aug 2001 14:51:31 +0000 (14:51 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Mon, 27 Aug 2001 14:51:31 +0000 (14:51 +0000)
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

diff --git a/scp.c b/scp.c
index 7b5dbe2..7ab3120 100644 (file)
--- 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.