Apply #52: d_namlen is non-standard.

This commit is contained in:
Jordan Bancino 2023-03-01 21:39:22 +00:00
parent 7a951c980f
commit d6f96757bc
1 changed files with 3 additions and 2 deletions

View File

@ -831,9 +831,10 @@ DbList(Db * db, size_t nArgs,...)
} }
while ((file = readdir(files))) while ((file = readdir(files)))
{ {
if (file->d_type == DT_REG && file->d_namlen > 5) size_t namlen = strlen(file->d_name);
if (file->d_type == DT_REG && namlen > 5)
{ {
int nameOffset = file->d_namlen - 5; int nameOffset = namlen - 5;
if (strcmp(file->d_name + nameOffset, ".json") == 0) if (strcmp(file->d_name + nameOffset, ".json") == 0)
{ {