Skip to content

Commit

Permalink
Don't use dirent's d_reclen as if it were d_namlen. (#128)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
waywardmonkeys authored Dec 23, 2020
1 parent 72948ae commit 16019c2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/dsk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 16019c2

Please sign in to comment.