[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes to grep/src/grep.c
From: |
Stepan Kasal |
Subject: |
Changes to grep/src/grep.c |
Date: |
Sat, 20 Nov 2004 11:31:04 -0500 |
Index: grep/src/grep.c
diff -u grep/src/grep.c:1.83 grep/src/grep.c:1.84
--- grep/src/grep.c:1.83 Sat Nov 20 16:15:57 2004
+++ grep/src/grep.c Sat Nov 20 16:20:38 2004
@@ -255,19 +255,6 @@
bufbeg[-1] = eolbyte;
bufdesc = fd;
- if (fstat (fd, &stats->stat) != 0)
- {
- error (0, errno, "fstat");
- return 0;
- }
- 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)))
-#endif
- return 0;
if (S_ISREG (stats->stat.st_mode))
{
if (file)
@@ -928,6 +915,19 @@
}
else
{
+ if (stat (file, &stats->stat) != 0)
+ {
+ suppressible_error (file, errno);
+ return 1;
+ }
+ if (directories == SKIP_DIRECTORIES && S_ISDIR (stats->stat.st_mode))
+ return 1;
+#ifndef DJGPP
+ 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)))
+#else
+ if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) ||
S_ISBLK(stats->stat.st_mode)))
+#endif
+ return 1;
while ((desc = open (file, O_RDONLY)) < 0 && errno == EINTR)
continue;