diff options
-rw-r--r-- | build/files.c | 2 | ||||
-rw-r--r-- | rpmio/rpmfileutil.h | 8 | ||||
-rw-r--r-- | rpmio/rpmglob.c | 6 |
3 files changed, 14 insertions, 2 deletions
diff --git a/build/files.c b/build/files.c index 349355723..f42110ac6 100644 --- a/build/files.c +++ b/build/files.c @@ -1597,7 +1597,7 @@ static rpmRC processBinaryFile(Package pkg, FileList fl, const char * fileName) if (trailing_slash && !fl->cur.isDir) fl->cur.isDir = -1; - doGlob = glob_pattern_p(fileName, quote); + doGlob = rpmIsGlob(fileName, quote); /* Check that file starts with leading "/" */ if (*fileName != '/') { diff --git a/rpmio/rpmfileutil.h b/rpmio/rpmfileutil.h index 52f8fbaeb..79fac8699 100644 --- a/rpmio/rpmfileutil.h +++ b/rpmio/rpmfileutil.h @@ -109,6 +109,14 @@ char * rpmGenPath (const char * urlroot, char * rpmGetPath (const char * path, ...) RPM_GNUC_NULL_TERMINATED; /** \ingroup rpmfileutil + * Check whether pattern contains any glob metacharacters. + * @param pattern glob pattern + * @param quote allow backslash quoting of metacharacters? + * @return 1 if pattern contains globs, 0 otherwise + */ +int rpmIsGlob(const char * pattern, int quote); + +/** \ingroup rpmfileutil * Return URL path(s) from a (URL prefixed) pattern glob. * @param patterns glob pattern * @retval *argcPtr no. of paths diff --git a/rpmio/rpmglob.c b/rpmio/rpmglob.c index d5fadbac6..2332ded55 100644 --- a/rpmio/rpmglob.c +++ b/rpmio/rpmglob.c @@ -54,7 +54,7 @@ int rpmGlob(const char * patterns, int * argcPtr, ARGV_t * argvPtr) int dir_only = (plen > 0 && path[plen-1] == '/'); glob_t gl; - if (!local || (!glob_pattern_p(av[j], 0) && strchr(path, '~') == NULL)) { + if (!local || (!rpmIsGlob(av[j], 0) && strchr(path, '~') == NULL)) { argvAdd(&argv, av[j]); continue; } @@ -146,3 +146,7 @@ exit: return rc; } +int rpmIsGlob(const char * pattern, int quote) +{ + return glob_pattern_p(pattern, quote); +} |