aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2020-05-18 17:03:42 -0400
committerRuss Cox <rsc@swtch.com>2020-05-18 17:04:36 -0400
commitc53ad837a734f7570badcb3666ccb3604e7e6467 (patch)
tree7afa8131e9d31dc307adcce9dddced7c34135a5b /src
parent587933c16132d880a06ff99bd087e64a3a04975e (diff)
downloadplan9port-c53ad837a734f7570badcb3666ccb3604e7e6467.tar.gz
plan9port-c53ad837a734f7570badcb3666ccb3604e7e6467.tar.bz2
plan9port-c53ad837a734f7570badcb3666ccb3604e7e6467.zip
lib9: avoid unportable use of d_namlen in dirread
Fixes #395.
Diffstat (limited to 'src')
-rw-r--r--src/lib9/open.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/lib9/open.c b/src/lib9/open.c
index 65ea99ec..2354268b 100644
--- 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)