start adding DM bits

This commit is contained in:
rsc 2005-02-08 20:08:28 +00:00
parent 8a26417b7a
commit 0a22905232
4 changed files with 16 additions and 8 deletions

View file

@ -9,20 +9,24 @@ extern int _p9dir(struct stat*, char*, Dir*, char**, char*);
Dir*
dirstat(char *file)
{
struct lstat lst;
struct stat st;
int nstr;
Dir *d;
char *str;
if(stat(file, &st) < 0)
if(lstat(file, &lst) < 0)
return nil;
st = lst;
if((lst.mode&S_IFMT) == S_ISLNK)
stat(file, &st);
nstr = _p9dir(&st, file, nil, nil, nil);
nstr = _p9dir(&lst, &st, file, nil, nil, nil);
d = mallocz(sizeof(Dir)+nstr, 1);
if(d == nil)
return nil;
str = (char*)&d[1];
_p9dir(&st, file, d, &str, str+nstr);
_p9dir(&lst, &st, file, d, &str, str+nstr);
return d;
}