delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/12/01/01:24:05

Date: Sun, 1 Dec 2002 08:21:21 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Andrew Cottrell <acottrel AT ihug DOT com DOT au>
cc: djgpp-workers AT delorie DOT com, Tim Van Holder <tim DOT van DOT holder AT pandora DOT be>
Subject: Re: Grep 2.5.1 directory bug
In-Reply-To: <002801c298db$08c76420$0100a8c0@p4>
Message-ID: <Pine.SUN.3.91.1021201081941.15364E-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sun, 1 Dec 2002, Andrew Cottrell wrote:

> Does anyone have any problems with this change?
> 
> New code:
> #if defined(HAVE_DIR_EACCES_BUG) || defined(DJGPP)
> # ifdef EISDIR
> #  define is_EISDIR(e, f) \
>      ((e) == EISDIR \
>       || ((e) == EACCES && isdir (f) && ((e) = EISDIR, 1)))
> # else
> #  define is_EISDIR(e, f) ((e) == EACCES && isdir (f))
> # endif
> #endif
[...]
> 2) The isdir() is a new for 2.5.1 and consists of the following :-
>     int isdir (const char *path)
>     {
>       struct stat stats;
>       return stat (path, &stats) == 0 && S_ISDIR (stats.st_mode);
>     }

If it's possible, I'd sugget to use `access' instead of `isdir', since 
the former is much faster on DJGPP platforms (`stat' is very expensive, 
while `access' is mostly a single system call).

Otherwise, fine; please submit this to the Grep maintainer.  Thanks for 
working on this.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019