[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] Re: [patch] findutils-4.1.20: use d_type in struct dire

From: Bruno Haible
Subject: Re: [Bug-gnulib] Re: [patch] findutils-4.1.20: use d_type in struct dirent
Date: Mon, 29 Mar 2004 13:01:29 +0200
User-agent: KMail/1.5

James Youngman wrote:
> > Here is a patch (originally by Jakub Jelinek) to use d_type in struct
> > dirent, if available, to avoid unnecessary stat() calls in some
> > expressions.
>    Gnulib guys, what do you think of the Gnulib patch?

Although using d_type instead of lstat() evidently increases performance,
I'd prefer to see a patch which

  - Uses the same interface on all platforms: Use DT_UNKNOWN instead of
    d_type on those platforms that don't have d_type. (Interfaces that
    depend on the platform easily lead to bugs that appear only on some
    platforms and not on others, defeating the purpose of gnulib.)

  - Uses a more appropriate data structure than a NUL terminated
    string whose last byte is a d_type value. (Btw, you know that on
    Linux, DT_UNKNOWN is 0; therefore when running on a newer libc but
    with an older kernel, readdir() will return d_type = DT_UNKNOWN for
    all entries, and you get fooled into cutting off the last byte of
    the real filename and interpreting it as a d_type value!)


reply via email to

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