diff options
author | rsc <devnull@localhost> | 2006-06-26 05:49:18 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2006-06-26 05:49:18 +0000 |
commit | 9bc519d686f2f3451e07ce5d814b3a85306a414d (patch) | |
tree | dfa99791af4425eb9f0e3fc41f2f41b2af9acd97 /src/cmd/sam | |
parent | ff63eeb1bd16c9fafe72d14edc410ccb18349cfc (diff) | |
download | plan9port-9bc519d686f2f3451e07ce5d814b3a85306a414d.tar.gz plan9port-9bc519d686f2f3451e07ce5d814b3a85306a414d.tar.bz2 plan9port-9bc519d686f2f3451e07ce5d814b3a85306a414d.zip |
fix dup file name bug
Diffstat (limited to 'src/cmd/sam')
-rw-r--r-- | src/cmd/sam/sam.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/cmd/sam/sam.c b/src/cmd/sam/sam.c index 120c53ac..f180290b 100644 --- a/src/cmd/sam/sam.c +++ b/src/cmd/sam/sam.c @@ -532,13 +532,22 @@ cd(String *str) Strduplstr(&owd, &curwd); getcurwd(); settempfile(); + /* + * Two passes so that if we have open + * /a/foo.c and /b/foo.c and cd from /b to /a, + * we don't ever have two foo.c simultaneously. + */ for(i=0; i<tempfile.nused; i++){ f = tempfile.filepptr[i]; if(f!=cmd && f->name.s[0]!='/' && f->name.s[0]!=0){ Strinsert(&f->name, &owd, (Posn)0); fixname(&f->name); sortname(f); - }else if(f != cmd && Strispre(&curwd, &f->name)){ + } + } + for(i=0; i<tempfile.nused; i++){ + f = tempfile.filepptr[i]; + if(f != cmd && Strispre(&curwd, &f->name)){ fixname(&f->name); sortname(f); } |