[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] fix segfault with -R --exclude-dir on stdin
From: |
Allan McRae |
Subject: |
[PATCH] fix segfault with -R --exclude-dir on stdin |
Date: |
Mon, 12 Mar 2012 11:06:31 +1000 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:10.0.2) Gecko/20120217 Thunderbird/10.0.2 |
Why people would want to use this combination of options on stdin is
beyond me, but this patch at least makes this combination not segfault
and act like "grep -R" on stdin (the behaviour of which has changed in
grep-2.11...)
>From 7c64a947d09747c8414c28cbe33ab3a7c1e71cbf Mon Sep 17 00:00:00 2001
From: Allan McRae <address@hidden>
Date: Mon, 12 Mar 2012 10:54:32 +1000
Subject: [PATCH] grep: fix segfault with -R --exclude-dir on stdin
* src/main.c: ensure dir is non-NULL before calling excluded_file_name
Signed-off-by: Allan McRae <address@hidden>
---
src/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main.c b/src/main.c
index 2f6c761..f4f1235 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1361,7 +1361,7 @@ grepdir (char const *dir, struct stats const *stats)
struct stats const *ancestor;
char *name_space;
int status = 1;
- if (excluded_directory_patterns
+ if (dir && excluded_directory_patterns
&& excluded_file_name (excluded_directory_patterns, dir))
return 1;
--
1.7.9.3
- [PATCH] fix segfault with -R --exclude-dir on stdin,
Allan McRae <=