lib9: avoid unportable use of d_namlen in dirread

Fixes #395.
This commit is contained in:
Russ Cox 2020-05-18 17:03:42 -04:00
parent 587933c161
commit c53ad837a7

View file

@ -318,8 +318,7 @@ dirreadmax(int fd, Dir **dp, int max)
return -1;
break;
}
if(de->d_name[de->d_namlen] != 0)
sysfatal("bad readdir");
// Note: not all systems have d_namlen. Assume NUL-terminated.
if(de->d_name[0]=='.' && de->d_name[1]==0)
continue;
if(de->d_name[0]=='.' && de->d_name[1]=='.' && de->d_name[2]==0)