Comment on dirents deep copy

This commit is contained in:
lostd 2014-10-08 22:55:44 +03:00
parent 973aff99b7
commit 368b43572d

View file

@ -234,6 +234,7 @@ begin:
if (strcmp(dp->d_name, ".") == 0 if (strcmp(dp->d_name, ".") == 0
|| strcmp(dp->d_name, "..") == 0) || strcmp(dp->d_name, "..") == 0)
continue; continue;
/* Deep copy because readdir(3) reuses the entries */
dents = realloc(dents, (n + 1) * sizeof(*dents)); dents = realloc(dents, (n + 1) * sizeof(*dents));
if (dents == NULL) if (dents == NULL)
printerr(1, "realloc"); printerr(1, "realloc");