<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From 5d89738649095a36f584ec30a59c945c8191593e Mon Sep 17 00:00:00 2001
From: Ismael Luceno &lt;ismael@iodev.co.uk&gt;
Date: Fri, 26 Jul 2019 18:13:14 +0200
Subject: [PATCH 4/6] glob: implement GLOB_NOMAGIC

Signed-off-by: Ismael Luceno &lt;ismael@iodev.co.uk&gt;
---
 include/glob.h   |  1 +
 src/regex/glob.c | 13 +++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/include/glob.h b/include/glob.h
index 4a562a206d52..0ff70bdfeef2 100644
--- a/include/glob.h
+++ b/include/glob.h
@@ -31,6 +31,7 @@ void globfree(glob_t *);
 #define GLOB_NOESCAPE 0x40
 #define	GLOB_PERIOD   0x80
 
+#define GLOB_NOMAGIC     0x0800
 #define GLOB_TILDE       0x1000
 #define GLOB_TILDE_CHECK 0x4000
 
diff --git a/src/regex/glob.c b/src/regex/glob.c
index 9de080ed9ccd..7780e21ee113 100644
--- a/src/regex/glob.c
+++ b/src/regex/glob.c
@@ -260,13 +260,18 @@ int glob(const char *restrict pat, int flags, int (*errfunc)(const char *path, i
 	
 	for (cnt=0, tail=head.next; tail; tail=tail-&gt;next, cnt++);
 	if (!cnt) {
+		size_t len;
 		if (flags &amp; GLOB_NOCHECK) {
-			tail = &amp;head;
-			if (append(&amp;tail, pat, strlen(pat), 0))
-				return GLOB_NOSPACE;
-			cnt++;
+			len = strlen(pat);
+		} else if (flags &amp; GLOB_NOMAGIC) {
+			len = strcspn(pat, "*?[");
+			if (pat[len]) return GLOB_NOMATCH;
 		} else
 			return GLOB_NOMATCH;
+		tail = &amp;head;
+		if (append(&amp;tail, pat, len, 0))
+			return GLOB_NOSPACE;
+		cnt++;
 	}
 
 	if (flags &amp; GLOB_APPEND) {
-- 
2.22.0

</pre></body></html>