[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [BUGFIX] Don't use DT_DIR: It doesn't work on non-ext* filesystems
From: |
Robert Millan |
Subject: |
Re: [BUGFIX] Don't use DT_DIR: It doesn't work on non-ext* filesystems |
Date: |
Sat, 25 Jul 2009 18:23:09 +0200 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Fri, Jul 24, 2009 at 05:49:19PM -0400, Pavel Roskin wrote:
> On Fri, 2009-07-24 at 23:02 +0200, Christian Franke wrote:
>
> > A correct performance-aware solution would look like:
> >
> > #ifdef DT_DIR
> > if (de->d_type == DT_DIR)
> > info.dir = 1;
> > else if (de->type == DT_FILE)
>
> There in no DT_FILE in glibc, but there is DT_REG. DT_UNKNOWN is
> present. Perhaps the above line should be
>
> else if (de->type != DT_UNKNOWN)
>
> We only care if it's a directory or not. All other objects can be
> treated like files.
>
> I'm fine either way, whether we fix the "high-performance" code or
> remove it, as long as we don't have to add more checks.
d_type doesn't always exist. E.g. on OpenSolaris.
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."