From 38932d1d175b8ff8a509d2d9995ffb3eb576ff3a Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 31 May 2012 15:40:51 +0300 Subject: [PATCH] Export our own version of glob_pattern_p() as rpmIsGlob() - Further preliminaries to hiding the glob() implementation --- build/files.c | 2 +- rpmio/rpmfileutil.h | 8 ++++++++ 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 @@ -108,6 +108,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 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); +}