bug-grep
[Top][All Lists]
Advanced

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

Re: MS-Windows build of Grep [1/4]


From: Eli Zaretskii
Subject: Re: MS-Windows build of Grep [1/4]
Date: Sat, 24 Dec 2011 14:55:15 +0200

This changeset fixes "grep -r" on MS-Windows (and also on MS-DOS).
Without it, Grep produces an error message "foo: Permission denied"
and quits.

        Fix "grep -r" on MS-Windows and MS-DOS.

        * src/system.h (is_EISDIR) [__MINGW32__ || __DJGPP__]: A different
        definition for DOS/Windows, to account for the fact that these
        systems set errno to EACCES instead of EISDIR.

diff -up -r grep-2.10.orig/src/system.h grep-2.10.MinGW/src/system.h
--- grep-2.10.orig/src/system.h 2011-11-12 12:59:34.000000000 +0200
+++ grep-2.10.MinGW/src/system.h        2011-12-20 11:41:49.545785700 +0200
@@ -34,7 +34,12 @@
 #endif
 
 #ifdef EISDIR
-# define is_EISDIR(e, f) ((e) == EISDIR)
+# if defined(__MINGW32__) || (__DJGPP__ == 2 && __DJGPP_MINOR__ < 4)
+#  define is_EISDIR(e, f)                                              \
+     ((e) == EISDIR || ((e) == EACCES && isdir(f) && ((e) = EISDIR, 1)))
+# else  /* not __MINGW32__, not __DJGPP__ < 2.04 */
+#  define is_EISDIR(e, f) ((e) == EISDIR)
+# endif
 #else
 # define is_EISDIR(e, f) 0
 #endif



reply via email to

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