diff options
author | Russ Cox <rsc@swtch.com> | 2008-07-04 16:24:54 -0400 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2008-07-04 16:24:54 -0400 |
commit | 9a939d5f194b7430553885926612adf10b265205 (patch) | |
tree | 06e3649e3fb3c99d6c4784f136e53654e6be2380 /src/lib9 | |
parent | bb53a229b2a997a0419c49ca2e7e968ef47e451d (diff) | |
download | plan9port-9a939d5f194b7430553885926612adf10b265205.tar.gz plan9port-9a939d5f194b7430553885926612adf10b265205.tar.bz2 plan9port-9a939d5f194b7430553885926612adf10b265205.zip |
lib9: do not try to hide symlinks as much
Diffstat (limited to 'src/lib9')
-rw-r--r-- | src/lib9/_p9dir.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/lib9/_p9dir.c b/src/lib9/_p9dir.c index bc54d677..1541f8f4 100644 --- a/src/lib9/_p9dir.c +++ b/src/lib9/_p9dir.c @@ -198,32 +198,33 @@ _p9dir(struct stat *lst, struct stat *st, char *name, Dir *d, char **str, char * d->mtime = st->st_mtime; d->length = st->st_size; - if(S_ISDIR(st->st_mode)){ - d->length = 0; - d->mode |= DMDIR; - d->qid.type = QTDIR; - } if(S_ISLNK(lst->st_mode)){ /* yes, lst not st */ d->mode |= DMSYMLINK; d->length = lst->st_size; } - if(S_ISFIFO(st->st_mode)) + else if(S_ISDIR(st->st_mode)){ + d->length = 0; + d->mode |= DMDIR; + d->qid.type = QTDIR; + } + else if(S_ISFIFO(st->st_mode)) d->mode |= DMNAMEDPIPE; - if(S_ISSOCK(st->st_mode)) + else if(S_ISSOCK(st->st_mode)) d->mode |= DMSOCKET; - if(S_ISBLK(st->st_mode)){ + else if(S_ISBLK(st->st_mode)){ d->mode |= DMDEVICE; d->qid.path = ('b'<<16)|st->st_rdev; } - if(S_ISCHR(st->st_mode)){ + else if(S_ISCHR(st->st_mode)){ d->mode |= DMDEVICE; d->qid.path = ('c'<<16)|st->st_rdev; } /* fetch real size for disks */ - if(S_ISBLK(st->st_mode) || S_ISCHR(st->st_mode)) - if((fd = open(name, O_RDONLY)) >= 0){ - d->length = disksize(fd, st); - close(fd); + if(S_ISBLK(lst->st_mode) || S_ISCHR(lst->st_mode)){ + if((fd = open(name, O_RDONLY)) >= 0){ + d->length = disksize(fd, st); + close(fd); + } } } |