]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Spotted by Tim Kosse: we were returning an incorrect path in canonify() when
authorJacob Nevins <jacobn@chiark.greenend.org.uk>
Sun, 22 Oct 2006 20:19:55 +0000 (20:19 +0000)
committerJacob Nevins <jacobn@chiark.greenend.org.uk>
Sun, 22 Oct 2006 20:19:55 +0000 (20:19 +0000)
we couldn't get any sense out of the server.

[originally from svn r6877]

psftp.c

diff --git a/psftp.c b/psftp.c
index d07ee8b0b7f2ae3d5bb8ce72c50571f4592561c0..f77a88ed78c33bedd6092e64e315c4289bc12e1a 100644 (file)
--- a/psftp.c
+++ b/psftp.c
@@ -128,8 +128,12 @@ char *canonify(char *name)
        assert(rreq == req);
        canonname = fxp_realpath_recv(pktin, rreq);
 
-       if (!canonname)
-           return fullname;           /* even that failed; give up */
+       if (!canonname) {
+           /* Even that failed. Restore our best guess at the
+            * constructed filename and give up */
+           fullname[i] = '/';  /* restore slash and last component */
+           return fullname;
+       }
 
        /*
         * We have a canonical name for all but the last path