plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

commit c53ad837a734f7570badcb3666ccb3604e7e6467
parent 587933c16132d880a06ff99bd087e64a3a04975e
Author: Russ Cox <rsc@swtch.com>
Date:   Mon, 18 May 2020 17:03:42 -0400

lib9: avoid unportable use of d_namlen in dirread

Fixes #395.

Diffstat:
Msrc/lib9/open.c | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/lib9/open.c b/src/lib9/open.c @@ -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)