Date: Sun, 1 Dec 2002 08:21:21 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Andrew Cottrell cc: djgpp-workers AT delorie DOT com, Tim Van Holder Subject: Re: Grep 2.5.1 directory bug In-Reply-To: <002801c298db$08c76420$0100a8c0@p4> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Precedence: bulk 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.