blob: fb6645f01f7e3a469878bacc830e272bb4d6100c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
--- grep-2.5.1a/src/grep.c.skip 2006-05-31 09:26:58.000000000 +0100
+++ grep-2.5.1a/src/grep.c 2006-05-31 09:28:24.000000000 +0100
@@ -261,19 +261,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)
@@ -875,6 +862,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;
|