OSDN Git Service
(root)
/
android-x86
/
external-toybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1f33eeb
)
Fix bug where grep stopped at first dangling symlink and error_exited().
author
Rob Landley
<rob@landley.net>
Sat, 10 Jun 2017 18:17:31 +0000
(13:17 -0500)
committer
Rob Landley
<rob@landley.net>
Sat, 10 Jun 2017 18:17:31 +0000
(13:17 -0500)
toys/posix/grep.c
patch
|
blob
|
history
diff --git
a/toys/posix/grep.c
b/toys/posix/grep.c
index
a95203a
..
c7b44e5
100644
(file)
--- a/
toys/posix/grep.c
+++ b/
toys/posix/grep.c
@@
-81,12
+81,18
@@
static void outline(char *line, char dash, char *name, long lcount, long bcount,
static void do_grep(int fd, char *name)
{
struct double_list *dlb = 0;
- FILE *file =
x
fdopen(fd, "r");
+ FILE *file = fdopen(fd, "r");
long lcount = 0, mcount = 0, offset = 0, after = 0, before = 0;
char *bars = 0;
if (!fd) name = "(standard input)";
+ if (!file) {
+ perror_msg("%s", name);
+
+ return;
+ }
+
// Loop through lines of input
for (;;) {
char *line = 0, *start;