This commit is contained in:
rsc 2005-02-08 20:24:52 +00:00
parent 17ddbe1196
commit 46199d113e

View file

@ -80,13 +80,14 @@ dirpackage(int fd, char *buf, int n, Dir **dp)
for(i=0; i<n; i++){ for(i=0; i<n; i++){
de = (struct dirent*)p; de = (struct dirent*)p;
memset(&lst, 0, sizeof lst);
if(de->d_name[0] == 0) if(de->d_name[0] == 0)
/* nothing */ {} /* nothing */ {}
else if(lstat(de->d_name, &lst) < 0) else if(lstat(de->d_name, &lst) < 0)
de->d_name[0] = 0; de->d_name[0] = 0;
else{ else{
st = lst; st = lst;
if((lst.st_mode&S_IFMT) == S_IFLNK) if(S_ISLNK(lst.st_mode))
stat(de->d_name, &st); stat(de->d_name, &st);
nstr += _p9dir(&lst, &st, de->d_name, nil, nil, nil); 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; m = 0;
for(i=0; i<n; i++){ for(i=0; i<n; i++){
de = (struct dirent*)p; 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; st = lst;
if((lst.st_mode&S_IFMT) == S_IFLNK) if((lst.st_mode&S_IFMT) == S_IFLNK)
stat(de->d_name, &st); stat(de->d_name, &st);