grub-devel
[Top][All Lists]
Advanced

[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: Christian Franke
Subject: Re: [BUGFIX] Don't use DT_DIR: It doesn't work on non-ext* filesystems
Date: Sat, 25 Jul 2009 00:02:28 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090403 SeaMonkey/1.1.16

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.

Yes correct.


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.


It depends: If DT_UNKNOWN is used, you have to replace stat() by lstat() in is_dir(). Otherwise symlinked directories would be appear as dir only if d_type == DT_UNKNOWN and not if d_type == DT_LNK.


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.


I would suggest to remove it.

--
Regards,
Christian Franke





reply via email to

[Prev in Thread] Current Thread [Next in Thread]