From: Oliver Kiddle Date: Sun, 24 Jun 2012 22:33:38 +0000 Subject: handle-removed-working-dir --- src/cmd/ksh93/bltins/cd_pwd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/cmd/ksh93/bltins/cd_pwd.c b/src/cmd/ksh93/bltins/cd_pwd.c index fb0dcda..d06cfba 100644 --- a/src/cmd/ksh93/bltins/cd_pwd.c +++ b/src/cmd/ksh93/bltins/cd_pwd.c @@ -115,7 +115,18 @@ int b_cd(int argc, char *argv[],Shbltin_t *context) if(*(dp=dir+1) == '.') dp++; if(*dp==0 || *dp=='/') + { + struct stat statb; + if((dp-dir)==2) + { + sfprintf(shp->strbuf,oldpwd); + dp = sfstruse(shp->strbuf); + *strrchr(dp,'/')=0; + if(*dp) + dir = (char*)dp; + } cdpath = 0; + } } rval = -1; do