Index: grep.c =================================================================== --- grep.c (revision 243423) +++ grep.c (working copy) @@ -304,7 +304,7 @@ 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))) + 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 @@ -942,6 +942,7 @@ int desc; int count; int status; + struct stat sb; if (! file) { @@ -950,6 +951,18 @@ } else { + if (stat(file, &sb)) + { + error (0, errno, "stat"); + return 0; + } +#ifndef DJGPP + if (devices == SKIP_DEVICES && (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode) || S_ISSOCK(sb.st_mode) || S_ISFIFO(sb.st_mode))) +#else + if (devices == SKIP_DEVICES && (S_ISCHR(sb->stat.st_mode) || S_ISBLK(sb.st_mode))) +#endif + return 0; + while ((desc = open (file, O_RDONLY)) < 0 && errno == EINTR) continue;