From: lostd Date: Wed, 8 Oct 2014 19:55:44 +0000 (+0300) Subject: Comment on dirents deep copy X-Git-Tag: v1.0~92^2~243 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=368b43572d3017542b2c2f056b196a4f7c79820f;p=nnn.git Comment on dirents deep copy --- diff --git a/noice.c b/noice.c index 8d6f0d75..66d856bc 100644 --- a/noice.c +++ b/noice.c @@ -234,6 +234,7 @@ begin: if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0) continue; + /* Deep copy because readdir(3) reuses the entries */ dents = realloc(dents, (n + 1) * sizeof(*dents)); if (dents == NULL) printerr(1, "realloc");