better symlink

This commit is contained in:
rsc 2005-02-21 14:25:12 +00:00
parent 5db61d6221
commit 98660df250
2 changed files with 10 additions and 4 deletions

View file

@ -180,8 +180,7 @@ _p9dir(struct stat *lst, struct stat *st, char *name, Dir *d, char **str, char *
d->mode |= DMDIR; d->mode |= DMDIR;
d->qid.type = QTDIR; d->qid.type = QTDIR;
} }
if(S_ISLNK(lst->st_mode)) /* yes, lst not st */
if(S_ISLNK(st->st_mode))
d->mode |= DMSYMLINK; d->mode |= DMSYMLINK;
if(S_ISFIFO(st->st_mode)) if(S_ISFIFO(st->st_mode))
d->mode |= DMNAMEDPIPE; d->mode |= DMNAMEDPIPE;

View file

@ -35,16 +35,23 @@ dirmodefmt(Fmt *f)
buf[0]='A'; buf[0]='A';
else if(m & DMDEVICE) else if(m & DMDEVICE)
buf[0] = 'D'; buf[0] = 'D';
else if(m & DMSYMLINK)
buf[0] = 'L';
else if(m & DMSOCKET) else if(m & DMSOCKET)
buf[0] = 'S'; buf[0] = 'S';
else if(m & DMNAMEDPIPE) else if(m & DMNAMEDPIPE)
buf[0] = 'P'; buf[0] = 'P';
else else
buf[0]='-'; buf[0]='-';
/*
* It's a little weird to have DMSYMLINK conflict with DMEXCL
* here, but since you can have symlinks to any of the above
* things, this is a better display. Especially since we don't do
* DMEXCL on any of the supported systems.
*/
if(m & DMEXCL) if(m & DMEXCL)
buf[1]='l'; buf[1]='l';
else if(m & DMSYMLINK)
buf[1] = 'L';
else else
buf[1]='-'; buf[1]='-';
rwx((m>>6)&7, buf+2); rwx((m>>6)&7, buf+2);