aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorDavid Xu <davidxu@FreeBSD.org>2013-01-22 03:23:14 +0000
committerDavid Xu <davidxu@FreeBSD.org>2013-01-22 03:23:14 +0000
commit87ec37621698d63cdfe3c98e8bd59c55e6abb443 (patch)
treed0bbe26b3f1c4132ccc3a2a25bab2d99c0e89780 /gnu
parent3193ad883a2e3242ecca6dd9ce79b0d1eb7c481d (diff)
Notes
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/grep/grep.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gnu/usr.bin/grep/grep.c b/gnu/usr.bin/grep/grep.c
index 1684a820b6701..0cab4a18f28df 100644
--- a/gnu/usr.bin/grep/grep.c
+++ b/gnu/usr.bin/grep/grep.c
@@ -304,7 +304,7 @@ reset (int fd, char const *file, struct stats *stats)
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 @@ grepfile (char const *file, struct stats *stats)
int desc;
int count;
int status;
+ int flags;
if (! file)
{
@@ -950,7 +951,7 @@ grepfile (char const *file, struct stats *stats)
}
else
{
- while ((desc = open (file, O_RDONLY)) < 0 && errno == EINTR)
+ while ((desc = open (file, O_RDONLY | O_NONBLOCK)) < 0 && errno == EINTR)
continue;
if (desc < 0)
@@ -990,6 +991,9 @@ grepfile (char const *file, struct stats *stats)
return 1;
}
+ flags = fcntl(desc, F_GETFL);
+ flags &= ~O_NONBLOCK;
+ fcntl(desc, F_SETFL, flags);
filename = file;
}