Re: [PATCH 4/3] Avoid using 'lstat()' to figure out directories
- From
Paolo Bonzini <bonzini@gnu.org>
- Date
- Jul 9, 2009, 22:36 UTC
- Message-ID
- <4A5670F3.9020309@gnu.org>
- In-Reply-To
- <alpine.LFD.2.01.0907091344340.3352@localhost.localdomain>
> + if (ce->name[len]> '/') > + break; > + if (ce->name[len]< '/') > + continue;
What about
if (ce->name[len] < '/') {
if (strchr(ce->name + len + 1, '/'))
break;
else
continue;
}to just punt if we'd go into a directory? I'm not much worried about accessing foo-0001, foo-0002, foo-0003 while looking for foo/a (that would be O(number of files in a directory), which is bearable), but risking to go down a huge subtree is not very nice.
Paolo