[PATCH 11/12] hush: only remove backslashes introduced from glob

Sascha Hauer s.hauer at pengutronix.de
Mon Mar 29 05:36:22 EDT 2010


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/hush.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/common/hush.c b/common/hush.c
index 6a8b56b..afa67d1 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -779,8 +779,9 @@ static int globhack(const char *src, int flags, glob_t *pglob)
 	int cnt=0, pathc;
 	const char *s;
 	char *dest;
+
 	for (cnt=1, s=src; s && *s; s++) {
-		if (*s == '\\') s++;
+		if (*s == '\\' && strchr("*[?", *(s + 1))) s++;
 		cnt++;
 	}
 	dest = xmalloc(cnt);
@@ -794,7 +795,7 @@ static int globhack(const char *src, int flags, glob_t *pglob)
 	pglob->gl_pathv[pathc-1] = dest;
 	pglob->gl_pathv[pathc] = NULL;
 	for (s=src; s && *s; s++, dest++) {
-		if (*s == '\\') s++;
+		if (*s == '\\' && strchr("*[?", *(s + 1))) s++;
 		*dest = *s;
 	}
 	*dest='\0';
-- 
1.7.0




More information about the barebox mailing list