1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-17 08:33:48 +00:00

Don't use dirent's d_reclen as if it were d_namlen. (#128)

This code was treating the `d_reclen` incorrectly from some of the
original old porting work. It is not the same as `d_namlen` and
`d_namlen` is not widely supported or standard. It should be using
`strlen(d_name)`.

This addresses an issue mentioned in interlisp/medley#103.
This commit is contained in:
Bruce Mitchener 2020-12-23 14:26:56 +07:00 committed by GitHub
parent 72948ae0fd
commit 16019c24eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2648,7 +2648,7 @@ static int locate_file(char *dir, char *name)
for (S_TOUT(dp = readdir(dirp)); dp != NULL || errno == EINTR;
errno = 0, S_TOUT(dp = readdir(dirp)))
if (dp) {
if (dp->d_reclen == len) {
if (strlen(dp->d_name) == len) {
strcpy(nb2, dp->d_name);
UPCASE(nb2);
if (strcmp(nb1, nb2) == 0) {