Skip to content
This repository has been archived by the owner on Oct 13, 2019. It is now read-only.

Commit

Permalink
Fix for larger dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
CTurt committed Aug 23, 2015
1 parent 14e7519 commit e5d0f9e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions examples/files/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,16 @@ int _main(void) {
return 1;
}

getdents(dfd, buffer, sizeof(buffer));
dent = (struct dirent *)buffer;

while(dent->d_fileno) {
debug(sock, "%s\n", dent->d_name);
while(getdents(dfd, buffer, sizeof(buffer)) != 0) {
dent = (struct dirent *)buffer;

while(dent->d_fileno) {
debug(sock, "%s\n", dent->d_name);

dent = (struct dirent *)((void *)dent + dent->d_reclen);
}

dent = (struct dirent *)((void *)dent + dent->d_reclen);
memset(buffer, 0, sizeof(buffer));
}


Expand Down

0 comments on commit e5d0f9e

Please sign in to comment.