[klibc] [klibc:update-dash] expand: Fix glibc glob(3) support

klibc-bot for Herbert Xu herbert at gondor.apana.org.au
Thu Jan 24 19:15:57 PST 2019


Commit-ID:  310b65b254706e687dee118ef3f3e22a9262d404
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=310b65b254706e687dee118ef3f3e22a9262d404
Author:     Herbert Xu <herbert at gondor.apana.org.au>
AuthorDate: Mon, 26 Mar 2018 17:50:24 +0800
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Fri, 25 Jan 2019 02:57:21 +0000

[klibc] expand: Fix glibc glob(3) support

It's been a while since we disabled glob(3) support by default.
It appears to be working now, however, we have to change our
code to detect the no-match case correctly.

In particular, we need to test for GLOB_NOMAGIC | GLOB_NOCHECK
instead of GLOB_MAGCHAR.

Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 usr/dash/expand.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/usr/dash/expand.c b/usr/dash/expand.c
index f52f34c9..3abfa0c4 100644
--- a/usr/dash/expand.c
+++ b/usr/dash/expand.c
@@ -1205,7 +1205,8 @@ expandmeta(str, flag)
 			ckfree(p);
 		switch (i) {
 		case 0:
-			if (!(pglob.gl_flags & GLOB_MAGCHAR))
+			if ((pglob.gl_flags & (GLOB_NOMAGIC | GLOB_NOCHECK)) ==
+			    (GLOB_NOMAGIC | GLOB_NOCHECK))
 				goto nometa2;
 			addglob(&pglob);
 			globfree(&pglob);


More information about the klibc mailing list