From: Alan Cox Date: Tue, 24 Jul 2018 23:15:38 +0000 (+0100) Subject: fsck: note an improvement to make X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=fdb47d9b790ec2269d4fdcf712a936e3dab3398c;p=FUZIX.git fsck: note an improvement to make --- diff --git a/Applications/util/fsck.c b/Applications/util/fsck.c index 5997020c..5338296d 100644 --- a/Applications/util/fsck.c +++ b/Applications/util/fsck.c @@ -658,6 +658,11 @@ static void ckdir(uint16_t inum, uint16_t pnum, char *name) } if (swizzle16(dentry.d_ino) != pnum && swizzle16(dentry.d_ino) != inum && depth < MAXDEPTH) { + /* FIXME: we should raise the depth but also get rid of the + malloc stuff as it performs badly when tight on memory. + Better to use a fixed 512 byte buffer we know is PATH_MAX + and avoid the dynamic allocations. Instead each recursion + we tack a name on and on return we set the old end to \0. */ ename = malloc(strlen(name) + strlen(dentry.d_name) + 2); if (ename == NULL) { fprintf(stderr, "Not enough memory.\n");