X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=psftp.c;h=f77a88ed78c33bedd6092e64e315c4289bc12e1a;hb=12e019bafc75cb441e965c63e15dfceeaf71ca1e;hp=d07ee8b0b7f2ae3d5bb8ce72c50571f4592561c0;hpb=c353c3cc972c611a37994704bb61b0d45999b0ab;p=PuTTY.git diff --git a/psftp.c b/psftp.c index d07ee8b0..f77a88ed 100644 --- 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