blob: 457d2428eb370c4a489f7e6feb06559454e584c9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
From: Oliver Kiddle <okiddle@yahoo.co.uk>
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
|