summaryrefslogtreecommitdiff
path: root/ext/File-Glob
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2014-12-31 11:16:06 +0000
committerDavid Mitchell <davem@iabyn.com>2014-12-31 11:28:52 +0000
commita08678bcb2357aeaaca8647b1fbfb92d260c22e6 (patch)
treead375deb897266a53b3dd0915e62ee9259e151b9 /ext/File-Glob
parent370e91aa758ff850f955a2c2502e9d48ec70390f (diff)
downloadperl-a08678bcb2357aeaaca8647b1fbfb92d260c22e6.tar.gz
File::Glob: avoid qsort() on no entries
If a glob doesn't match anything, it will try to call qsort() with a null pointer, and on my OS, qsort() marked as needing a non-null arg, which clang 3.6 is now detecting.
Diffstat (limited to 'ext/File-Glob')
-rw-r--r--ext/File-Glob/bsd_glob.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ext/File-Glob/bsd_glob.c b/ext/File-Glob/bsd_glob.c
index 2ba0d49407..821ef200ad 100644
--- a/ext/File-Glob/bsd_glob.c
+++ b/ext/File-Glob/bsd_glob.c
@@ -602,6 +602,7 @@ glob0(const Char *pattern, glob_t *pglob)
return(globextend(qpat, pglob, &limit));
}
else if (!(pglob->gl_flags & GLOB_NOSORT))
+ if (pglob->gl_pathv)
qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc,
pglob->gl_pathc - oldpathc, sizeof(char *),
(pglob->gl_flags & (GLOB_ALPHASORT|GLOB_NOCASE))