bug-grep
[Top][All Lists]
Advanced

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

Re: grep --devices=skip does not ignore FIFOs (version 2.5.1a +FIX)


From: Ken Lalonde
Subject: Re: grep --devices=skip does not ignore FIFOs (version 2.5.1a +FIX)
Date: Fri, 16 Jun 2006 12:22:05 -0400
User-agent: Mutt/1.4.2.1i

Further to my previous message:

The patch I included is incorrect: when --devices=skip is specified,
the patch will cause "grep ... <data" to fail, since stdin is a FIFO.

Here's a corrected version:

--- grep.c.orig Fri Jun 16 11:53:37 2006
+++ grep.c      Fri Jun 16 12:18:12 2006
@@ -262,11 +262,13 @@
     }
   if (directories == SKIP_DIRECTORIES && S_ISDIR (stats->stat.st_mode))
     return 0;
-#ifndef DJGPP
-  if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || 
S_ISBLK(stats->stat.st_mode) || S_ISSOCK(stats->stat.st_mode)))
-#else
-  if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || 
S_ISBLK(stats->stat.st_mode)))
+#ifndef S_ISFIFO
+# define S_ISFIFO(m) 0
 #endif
+#ifndef S_ISSOCK
+# define S_ISSOCK(m) 0
+#endif
+  if (devices == SKIP_DEVICES && file && (S_ISCHR(stats->stat.st_mode) || 
S_ISBLK(stats->stat.st_mode) || S_ISSOCK(stats->stat.st_mode) || 
S_ISFIFO(stats->stat.st_mode)))
     return 0;
   if (S_ISREG (stats->stat.st_mode))
     {





reply via email to

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