From 1309dd2cc1d464ab24283119eda2aa487338b9be Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Sat, 15 Aug 2020 15:47:51 -0400 Subject: put fnmatch() parameters in the right order --- src/glob/glob.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/glob/glob.c') diff --git a/src/glob/glob.c b/src/glob/glob.c index ef94d919..eafc1c82 100644 --- a/src/glob/glob.c +++ b/src/glob/glob.c @@ -58,7 +58,7 @@ int glob(const char * restrict pattern, int flags, int (*errfunc) (const char * do { const char *p = path + strlen(path) + 1; struct dirent *de; - DIR *d = opendir(path); + DIR *d = opendir(slashes ? path : "."); if (d == NULL) { if (errfunc != NULL) { if (errfunc(path, errno) != 0) { @@ -72,7 +72,7 @@ int glob(const char * restrict pattern, int flags, int (*errfunc) (const char * } while ((de = readdir(d)) != NULL) { - if (fnmatch(de->d_name, p, fnmatch_flags) == 0) { + if (fnmatch(p, de->d_name, fnmatch_flags) == 0) { pglob->gl_pathc++; char **tmp = realloc(pglob->gl_pathv, sizeof(char*) * pglob->gl_pathc); if (tmp == NULL) { -- cgit v1.2.1