diff options
author | rsc <devnull@localhost> | 2005-02-08 20:24:52 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-02-08 20:24:52 +0000 |
commit | 46199d113e9b607ecb42601246103ded683ca09e (patch) | |
tree | cf37c71533f3b22da9a0c86054359f76ee9f11f7 /src | |
parent | 17ddbe119678c9b9a07d4767e43c928e85ca96e6 (diff) | |
download | plan9port-46199d113e9b607ecb42601246103ded683ca09e.tar.gz plan9port-46199d113e9b607ecb42601246103ded683ca09e.tar.bz2 plan9port-46199d113e9b607ecb42601246103ded683ca09e.zip |
bug fix
Diffstat (limited to 'src')
-rw-r--r-- | src/lib9/dirread.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib9/dirread.c b/src/lib9/dirread.c index 44307ed7..a68cfaad 100644 --- a/src/lib9/dirread.c +++ b/src/lib9/dirread.c @@ -80,13 +80,14 @@ dirpackage(int fd, char *buf, int n, Dir **dp) for(i=0; i<n; i++){ de = (struct dirent*)p; + memset(&lst, 0, sizeof lst); if(de->d_name[0] == 0) /* nothing */ {} else if(lstat(de->d_name, &lst) < 0) de->d_name[0] = 0; else{ st = lst; - if((lst.st_mode&S_IFMT) == S_IFLNK) + if(S_ISLNK(lst.st_mode)) stat(de->d_name, &st); nstr += _p9dir(&lst, &st, de->d_name, nil, nil, nil); } @@ -106,7 +107,7 @@ dirpackage(int fd, char *buf, int n, Dir **dp) m = 0; for(i=0; i<n; i++){ de = (struct dirent*)p; - if(de->d_name[0] != 0 && lstat(de->d_name, &st) >= 0){ + if(de->d_name[0] != 0 && lstat(de->d_name, &lst) >= 0){ st = lst; if((lst.st_mode&S_IFMT) == S_IFLNK) stat(de->d_name, &st); |