From 9f17da92d2623b5f5e6d96c4d6b85c45f7f79110 Mon Sep 17 00:00:00 2001 From: Ignacio Casal Quinteiro Date: Mon, 17 Sep 2018 15:20:00 +0200 Subject: [PATCH] On Windows the path prefix should be checked caseless --- libpkgconf/pkg.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libpkgconf/pkg.c b/libpkgconf/pkg.c index 0c3a692..f723c30 100644 --- a/libpkgconf/pkg.c +++ b/libpkgconf/pkg.c @@ -188,6 +188,16 @@ determine_prefix(const pkgconf_pkg_t *pkg, char *buf, size_t buflen) return buf; } +static bool +is_path_prefix_equal(const char *path1, const char *path2, size_t path2_len) +{ +#ifdef _WIN32 + return !_strnicmp(path1, path2, path2_len); +#else + return !strncmp(path1, path2, path2_len); +#endif +} + static bool pkgconf_pkg_parser_value_set(pkgconf_pkg_t *pkg, const size_t lineno, const char *keyword, char *value) { @@ -198,7 +208,7 @@ pkgconf_pkg_parser_value_set(pkgconf_pkg_t *pkg, const size_t lineno, const char * file and rewrite any directory that starts with the same prefix. */ if (pkg->owner->flags & PKGCONF_PKG_PKGF_REDEFINE_PREFIX && pkg->orig_prefix - && !strncmp(value, pkg->orig_prefix->value, strlen(pkg->orig_prefix->value))) + && is_path_prefix_equal(canonicalized_value, pkg->orig_prefix->value, strlen(pkg->orig_prefix->value))) { char newvalue[PKGCONF_ITEM_SIZE];