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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 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


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox

[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux