Skip to content

Commit 16019c2

Browse files
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.
1 parent 72948ae commit 16019c2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/dsk.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2648,7 +2648,7 @@ static int locate_file(char *dir, char *name)
26482648
for (S_TOUT(dp = readdir(dirp)); dp != NULL || errno == EINTR;
26492649
errno = 0, S_TOUT(dp = readdir(dirp)))
26502650
if (dp) {
2651-
if (dp->d_reclen == len) {
2651+
if (strlen(dp->d_name) == len) {
26522652
strcpy(nb2, dp->d_name);
26532653
UPCASE(nb2);
26542654
if (strcmp(nb1, nb2) == 0) {

0 commit comments

Comments
 (0)