X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/6226c9390d23d6868edde63b9568891cd88631cc..2733b5cbea482cab35d9318a4f8a7fbeb845668e:/psftp.c 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