Tim Waugh 35b335
--- grep-2.5.1a/src/grep.c.skip	2006-05-31 09:26:58.000000000 +0100
Tim Waugh 35b335
+++ grep-2.5.1a/src/grep.c	2006-05-31 09:28:24.000000000 +0100
Tim Waugh 35b335
@@ -261,19 +261,6 @@
Tim Waugh 35b335
   bufbeg[-1] = eolbyte;
Tim Waugh 35b335
   bufdesc = fd;
Tim Waugh 35b335
 
Tim Waugh 35b335
-  if (fstat (fd, &stats->stat) != 0)
Tim Waugh 35b335
-    {
Tim Waugh 35b335
-      error (0, errno, "fstat");
Tim Waugh 35b335
-      return 0;
Tim Waugh 35b335
-    }
Tim Waugh 35b335
-  if (directories == SKIP_DIRECTORIES && S_ISDIR (stats->stat.st_mode))
Tim Waugh 35b335
-    return 0;
Tim Waugh 35b335
-#ifndef DJGPP
Tim Waugh 35b335
-  if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode) || S_ISSOCK(stats->stat.st_mode)))
Tim Waugh 35b335
-#else
Tim Waugh 35b335
-  if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode)))
Tim Waugh 35b335
-#endif
Tim Waugh 35b335
-    return 0;
Tim Waugh 35b335
   if (S_ISREG (stats->stat.st_mode))
Tim Waugh 35b335
     {
Tim Waugh 35b335
       if (file)
Tim Waugh 35b335
@@ -875,6 +862,19 @@
Tim Waugh 35b335
     }
Tim Waugh 35b335
   else
Tim Waugh 35b335
     {
Tim Waugh 35b335
+      if (stat (file, &stats->stat) != 0)
Tim Waugh 35b335
+        {
Tim Waugh 35b335
+          suppressible_error (file, errno);
Tim Waugh 35b335
+          return 1;
Tim Waugh 35b335
+        }
Tim Waugh 35b335
+      if (directories == SKIP_DIRECTORIES && S_ISDIR (stats->stat.st_mode))
Tim Waugh 35b335
+        return 1;
Tim Waugh 35b335
+#ifndef DJGPP
Tim Waugh 35b335
+      if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode) || S_ISSOCK(stats->stat.st_mode) || S_ISFIFO(stats->stat.st_mode)))
Tim Waugh 35b335
+#else
Tim Waugh 35b335
+      if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode)))
Tim Waugh 35b335
+#endif
Tim Waugh 35b335
+        return 1;
Tim Waugh 35b335
       while ((desc = open (file, O_RDONLY)) < 0 && errno == EINTR)
Tim Waugh 35b335
 	continue;
Tim Waugh 35b335