tfix dup file name bug - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 9bc519d686f2f3451e07ce5d814b3a85306a414d
 (DIR) parent ff63eeb1bd16c9fafe72d14edc410ccb18349cfc
 (HTM) Author: rsc <devnull@localhost>
       Date:   Mon, 26 Jun 2006 05:49:18 +0000
       
       fix dup file name bug
       
       Diffstat:
         M src/cmd/sam/sam.c                   |      11 ++++++++++-
       
       1 file changed, 10 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/src/cmd/sam/sam.c b/src/cmd/sam/sam.c
       t@@ -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);
                        }